shell脚本中获取后台启动的进程PID

#! /bin/bash
/home/lsy/shell/write.sh >/dev/null 2>&1 &
num=$(jobs -l | awk 'NR=1{print $2}')
echo $num