If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > output of the command $! , $_ and $$

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-25-09, 17:19
nitikamehta23 nitikamehta23 is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
output of the command $! , $_ and $$

Hi,
In Shell script, what will be the output of the command $! , $_ and $$ ?

Thanks
Reply With Quote
  #2 (permalink)  
Old 06-25-09, 19:40
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by nitikamehta23
Hi,
In Shell script, what will be the output of the command $! , $_ and $$ ?

Thanks
They are not commands, they are special shell variables.
  • $! the process id of the last command run in the background.
  • $- the current options supplied to this invocation of the shell.
  • $_ Last argument of previous command
  • $$ the process number of this shell - useful for including in filenames, to make them unique.
Use the echo command to see what they contain.

Mike
Reply With Quote
  #3 (permalink)  
Old 06-26-09, 10:01
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
I just would like to add something to $$: do not rely on a really unique file name using $$. For anything bordering on important things, additional checks will be needed.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On