12

Can anyone tell me what does echo $! mean and how it comes(meaning of '$' and '!')?

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
cache
  • 1,239
  • 3
  • 13
  • 21
  • Related http://stackoverflow.com/questions/5163144/what-are-the-special-dollarsign-variables-possibly-bash-only – coelhudo Jul 06 '12 at 20:21
  • 2
    man bash... look for `special parameters` – Anya Shenanigans Jul 06 '12 at 20:22
  • It's not in "Linux". I guess tou mean `bash` or another shell. The `$!` thing can also be used on bash on an proprietary Unix. – Luc M Jul 06 '12 at 20:23
  • ...or in any POSIX-compliant shell, not just bash. – Charles Duffy Apr 14 '21 at 16:01
  • 1
    @Vertexwahn, ...btw, editing old posts does have the effect of bringing them back to the front page; something to consider when evaluating the value of a trivial edit, particularly to a question that consensus has determined to be off-topic. – Charles Duffy Apr 14 '21 at 16:03

1 Answers1

31

$! PID of last job running in background.

Otto Allmendinger
  • 27,448
  • 7
  • 68
  • 79