Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

quick question

Status
Not open for further replies.

hokky

Technical User
Nov 9, 2006
170
AU
Hi guys just wondering what this means, any example to explain it :

Code:
ps_id=$!

wait $ps_id

what '$!' means ? process id ??

and what's the difference between
'wait'
and
'wait $ps_id'

Thanks guys
 
Hi,

Shell has some built-in variables :
$! PID of the last background command
$? status of execution of last command
$$ PID of the current runnin process
$# number of arguments passed to the running script
$PWD current workin directory
etc...

man sh; man ksh or even what shell you are using for more infos
 
The difference between "[tt]wait[/tt]" and "[tt]wait $ps_id[/tt]" is that the "[tt]wait[/tt]" will wait for all subprocesses of this process to end, where the "[tt]wait $ps_id[/tt]" is waiting for a specific process to end, the one who's PID was captured in the variable "[tt]ps_id[/tt]".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top