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)
#!/bin/bash
pid=$$
echo "Current script PID: $pid"
$! returns last program PID that your shell ran in the background (e.g. command &)
#!/bin/bash
sleep 5 &
pid=$!
echo "sleep command PID: $pid"
0 comments
Add comment