x

Unix Command Line Arguments

PREV     NEXT

UNIX Command Line Arguments / Special Unix variables and its description:

 

  • $0 –       Shows value of the command itself (program name)
  • $1  –      First command line argument
  • $2  –      Second command line argument
  • .               .
  • .               .
  • .               .
  • $9  –       Ninth command line argument
  • ${10}  – Tenth command line argument
  • $#  –      Total number of command line arguments
  • $*  –      A space-separated list of command line arguments

Ex:


$?  –  To check the exit status of the command which was last executed. If the last command executed successfully then it will return the output as 0 else it would be non-zero.

Ex:



Like it? Please Spread the word!