Accessing Command-line Arguments $1 $# $*

3 views
Skip to first unread message

hq4...@gmail.com

unread,
Mar 28, 2005, 8:35:04 AM3/28/05
to bash...@googlegroups.com
#!/bin/sh
# Illustrates using command-line arguments
# Execute with
# sh args1.sh On the Waterfront
echo "First command-line argument is: $1"
echo "Third argument is: $3"
echo "Number of arguments is: $#"
echo "The entire list of arguments is: $*"

* Execute the script with

sh args1.sh -x On the Waterfront

Reply all
Reply to author
Forward
0 new messages