Command-line arguments

Revision as of 15:15, 13 February 2007 by MikeMol (talk | contribs) (Filled out task, added example.)

Template:Programming Task

Retrieve the list of command-line arguments given to the program.

Example command line:

myprogram -c "alpha beta" -h "gamma"

UNIX Shell

sh

To retrieve the entire list of arguments:

WHOLELIST="$@"

To retrieve the second and fifth arguments:

SECOND=$2
FIFTH=$5