$$ value changes often


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers $$ value changes often
# 1  
Old 06-21-2012
$$ value changes often

May i know why $$ changes often?
Code:
bash-2.05b$ perl -e'print "$$\n"'                                                                                          
4444236
bash-2.05b$ echo $$
4100348
bash-2.05b$ perl -e'print "$$\n"'
4431936
bash-2.05b$ echo $$;perl -e'print "$$\n"'
4100348
4268078

Thanks
# 2  
Old 06-21-2012
Notice that 4100348 does not change, as this is your current shell. The other numbers are the PID or the various perl interpreter processes that get started..
# 3  
Old 06-21-2012
try this for current shell pid
Code:
typeset -x x=$$ ; perl -e 'print "$ENV{x}\n"'

 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question