Okay, I've got a program I'm trying to fix, for lengthy reasons a rewrite isn't the greatest option... So, I've been up for 8 hours trying to solve this and I'm completely stumped.
I'm trying to get the PID of the ffmpeg in this nested subshell command:
(touch ~/addThumSlate.1BUSY.FILE; echo "" | ffmpeg -I "~/thumb_0011374_402.mov" "~/0011374/402_slated.mxv" > "~/0011374_402-addThumSlate1.txt" 2>&1; rm -f ~/addThumSlate1.BUSY.FILE) >/dev/null 2>&1 & echo $!
Obviously the final " & echo $!" does not return the pid of the ffmpeg command, and "echo $!" doesn't work within a subshell, and I tried messing around with
echo $$; ( : ; bash -c 'echo $PPID' ) but that was only retuning me the parent shell for some reason?
Caveat, this is bash 3.2 running on a Mac, so
$BASHPID is out. Also, I can't
ps | grep 'ffmpeg', as there are multiple ffmpegs running. I've trolled the interwebs trying to find a solution.
Hoping you can help,
-Sleepless in a subshell