Faulek Faulek - 5 months ago 26
Bash Question

What does "$!" mean?

I have some bash shell script code

#!/bin/bash
var=""
something happens here
var=$!


I could't find anyting about it and I'm not sure if it makes any sense but if so - what does it mean?

Thanks.

EDIT: Wow - looks like I didn't search deep enough - the answer lies hier What are the special dollar sign shell variables?

Answer

$! resolves to the process id of the latest process run in the background.