Nasser Heidari

2009-02-01

Special shell parameters

Filed under: Linux — Nasser Heidari @ 12:35

Special shell parameters ($?, $*,…) may only be referenced;

assignment to them is not allowed.

$*command-line arguments as one string

$@ command-line arguments as list of strings (useful for writing wrapper shell scripts that just add one argument)

$# number of command-line arguments

$? status of the most recently executed foreground pipeline, i.e., the exit code of the last command

$$ process ID of the shell. In a () subshell, it expands to the process ID of the current shell, not the subshell.

$! process ID of the most recent background command (after executed with &).

$0 name of the shell or shell script.

$- current option flags as specified upon invocation, by the set command, or those set by the shell itself (such as the -i option).

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: