Monday, July 20, 2009

Command Line Arguments

Here's a little script that may help you understand how command line arguments are read.
#!/bin/sh
#
# Script that demos, command line args
#
echo "Total number of command line argument are $#"
echo "$0 is script name"
echo "$1 is first argument"
echo "$2 is second argument"
echo "All of them are :- $* or $@"

So if you can set a variable inside of your script like this:
arg1=$1

No comments:

Post a Comment