Featured Post

Tuesday, April 5, 2016

positional parameters in UNIX shell script

 

     Positional parameters are nothing but a series of command line arguments passed to a shell script. Positional parameters can be used to pass information to a script.The following are some of the positional parameters used in shell script.

   $0                  -----     refers to the name of command or shell script itself

   $*                  -----    stands for all the command line arguments supplied starting from $1

   $#               -----    Total number of arguments supplied.

   $1,$2....$9     ----      positional parameters supplied to a program .

   $*                  -----   all the arguments are double quoted. For example if a script receives 
                                    two arguments, then $* is equivalent to $1 $2

  $@                 ------ works similar to $*

  $?                   ----- exit status of the last command supplied.

  $$                   -----  the process number of the current shell

  $!                    ----- the process number of the last back ground shell.




command line arguments , shell arguments in unix shell script , supplying command line arguments to shell script, shell variables, $0,$*,$#,$?,$$, getting process id,
  

No comments:

Post a Comment