#!/bin/sh echo $1 $2 $3
apple pear orange
#!/bin/sh shift 1 echo $1 $2 $3
#!/bin/sh
scriptname=$0 # $0 is the name of the program
function usage () {
cat <<EOF
Usage: scriptname [-p] [-v] [-h] filename
-p probes the ftp sites and check urls in
filename
-v executes and prints out verbose messages
-h displays basic help
EOF
}
if [ "$1" = "-h" ]
then
usage
exit 0
fi
#!/bin/sh
progname=$0
function usage () {
cat <<EOF
Usage: $progname [-a] [-b name] [-c] etc
EOF
exit 0
}
while getopts ":ab:ch" opt; do
case $opt in
a ) echo "found -a" ;;
b ) echo "found -b and $OPTARG is after -b" ;;
c ) echo "found -c" ;;
h ) echo "found $opt" ; usage ;;
\?) usage ;;
esac
done
shift $(($OPTIND - 1))
echo "the remaining arguments are: $1 $2 $3"
found h Usage: ./args3.sh [-a] [-b name] [-c] etc
./args3.sh -a -c found -a found -c the remaining arguments are:
./args3.sh -a -c foo bar mumble found -a found -c the remaining arguments are: foo bar mumble
./args3.sh -a -b file foo bar mumble found -a found -b and file is the argument to -b the remaining arguments are: foo bar mumble
#!/bin/sh
scriptname=$0 # $0 is the name of the program
verbose=no
probeonly=no
function usage () {
cat <<EOF
Usage: $scriptname [-p] [-v] [-h] filename
-p probes the ftp sites and check urls in
filename
-v executes and prints out verbose messages
-h displays basic help
EOF
exit 0
}
while getopts ":pvh" opt; do
case $opt in
v ) verbose=yes ;;
p ) probeonly=yes ;;
h ) usage ;;
\?) usage ;;
esac
done
shift $(($OPTIND - 1))
echo "verbose=$verbose probeonly=$probeonly"
echo "remaining arguments=$*"
# etc etc
./autoftp3.sh -v verbose=yes probeonly=no other args=
./autoftp3.sh -v -p foo bar verbose=yes probeonly=yes other args=foo bar
./autoftp3.sh -h
Usage: ./autoftp3.sh [-p] [-v] [-h] filename
-p probes the ftp sites and check urls in
filename
-v executes and prints out verbose messages
-h displays basic help
This document was produced using groff-1.19.