UNIX Shell Scripting - Command Line Arguments

You can pass variables while executing the script.

The command line arguments are numbered from $0 to $9, where $0 is the name of the script itself and $1 to $9 are first to ninth argument respectively. You can use more arguments by refering them as ${nn}.

You can use shift command to shift the arguments to left. This is useful when you want to scan through the arguments.

The following additional variables are defined apart from the command line arguments:
$# refers to the number of arguments passed
$@ refers to all the argumets as a string
$- refers to flags called
$$ refers to the PID of shell

Comments

Post a Comment

Popular posts from this blog

OS/DB Migration - CMD. STR, TOC, EXT, R3load, DDLDBS.TPL and more

Fixing Inconsistent Table - Table activation fails due to inconsistency between DD and DB

301 Redirect Using SAP Web Dispatcher