I am trying to know the pid of a function that was run as child process on a script
FUNCtstPsSelf.sh
#!/bin/bash
echo "pid=$$;ppid=$PPID"
ps -p $$
function FUNCtstPsSelf() {
sleep 3;
echo "$FUNCNAME:pid=$$;ppid=$PPID";
ps -p $$ -o pid,ppid,command;
}
FUNCtstPsSelf&
sleep 1;
but it can't find the pid! what now?