IT Community - Software Programming, Web Development and Technical Support

Shell variables

This is a discussion on Shell variables within the Operating Systems forums, part of the Computer Hardware/Software and Networking category; Hi Guys please let me know about the shell variables?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Computer Hardware/Software and Networking > Operating Systems

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-18-2007, 04:51 AM
vigneshgets vigneshgets is offline
D-Web Genius
 
Join Date: Mar 2007
Posts: 904
vigneshgets is on a distinguished road
Post Shell variables

Hi Guys please let me know about the shell variables?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-19-2007, 12:16 PM
vadivelanvaidyanathan vadivelanvaidyanathan is offline
D-Web Genius
 
Join Date: Feb 2007
Posts: 803
vadivelanvaidyanathan is on a distinguished road
Default Re: Shell variables

There are some variables which are set internally by the shell and which are available to the user:


Name Description
--------------------------------------------------------------------------
$1 - $9 these variables are the positional parameters.

$0 the name of the command currently being executed.

$# the number of positional arguments given to this
invocation of the shell.

$? the exit status of the last command executed is
given as a decimal string. When a command
completes successfully, it returns the exit status
of 0 (zero), otherwise it returns a non-zero exit
status.

$$ the process number of this shell - useful for
including in filenames, to make them unique.

$! the process id of the last command run in
the background.

$- the current options supplied to this invocation
of the shell.

$* a string containing all the arguments to the
shell, starting at $1.

$@ same as above, except when quoted.

--------------------------------------------------------------------------------
Notes
$* and $@ when unquoted are identical and expand into the arguments.

"$*" is a single word, comprising all the arguments to the shell, joined together with spaces. For example '1 2' 3 becomes "1 2 3".

"$@" is identical to the arguments received by the shell, the resulting list of words completely match what was given to the shell. For example '1 2' 3 becomes "1 2" "3"
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass variables from one page to another? senraj PHP Programming 6 01-29-2008 03:56 AM
How to define a static variables in php. itbarota PHP Programming 1 11-10-2007 04:40 AM
Ajax and Viewstate variables Balasubramanian.S C# Programming 1 09-20-2007 08:10 AM
Shell Script Tips & Tricks : a.deeban Operating Systems 18 09-07-2007 05:48 PM
Executing external programs via the shell in PHP Jeyaseelansarc PHP Programming 0 05-24-2007 01:09 AM


All times are GMT -7. The time now is 02:29 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0