skip to main content

SAP NetWeaver Newbie

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

2 comments:

  1. so good
    thank you for a hard work...

    ReplyDelete
  2. Ashraf, Glad to know you found the post useful!

    ReplyDelete

Email Subscription

Get every new post into your inbox by subscribing us.

Want a reason to subscribe?
1. This sitemap might convince you to subscribe.
2. We do not misuse email IDs. We respect privacy.

© 2008 - 2017 sapnwnewbie. All rights reserved.