Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-21-2012
pandeesh's Avatar
Registered User
 
Join Date: Jul 2011
Posts: 313
Thanks: 76
Thanked 12 Times in 12 Posts
$$ 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
Sponsored Links
    #2  
Old 06-21-2012
Scrutinizer's Avatar
Moderator
 
Join Date: Nov 2008
Location: Amsterdam
Posts: 7,350
Thanks: 144
Thanked 1,756 Times in 1,593 Posts
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..
Sponsored Links
    #3  
Old 06-21-2012
ygemici ygemici is offline Forum Advisor  
sed_shell@LNU
 
Join Date: Feb 2010
Location: istanbul
Posts: 1,629
Thanks: 1
Thanked 279 Times in 272 Posts
try this for current shell pid

Code:
typeset -x x=$$ ; perl -e 'print "$ENV{x}\n"'

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 01:41 PM.