Search This Blog

Get the pid of a command running background

sleep 100 &
echo $!
Note: $! holds the pid of the command.

No comments:

Post a Comment