EN
What does mean $$ or $! in Bash?
1 answers
4 points
What is defference beetween $$
and $!
?
As I see, both returns some number.
1 answer
6 points
$$
returns currently run process ID (PID)
xxxxxxxxxx
1
2
3
pid=$$
4
5
echo "Current script PID: $pid"
$!
returns last program PID that your shell ran in the background (e.g. command &
)
xxxxxxxxxx
1
2
3
sleep 5 &
4
pid=$!
5
6
echo "sleep command PID: $pid"
0 commentsShow commentsAdd comment