If I'm assigning a variable with
what would it be its value?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
$! contains the process ID of the most recently executed background pipeline. From
The shell treats several parameters specially. These parameters may only be referenced; assignment to them is not allowed.
!- Expands to the process ID of the most recently executed background (asynchronous) command.
$ sleep 60 &  6238 $ echo "$!" 6238
From Bash's man page:
! Expands to the process ID of the most recently executed background (asynchronous) command.
$! would contain the process ID (PID) of the last job that was backgrounded.
$ sleep 100 &  18813 $ echo "$!" 18813