#!/bin/bash echo $1 if [ $# -ne 0 ]; then if [ $1 -eq 1 ]; then echo "the argv = $1" echo "the argc = $#" #note: argc use $# fi else echo "Usage: \"sh argv.sh\" 1 or \"sh argv.sh 1 2\""; fi |
result
steven@ATM64:~/shell$ sh argv.sh 1 2 3 1 the argv = 1 the argc = 3 steven@ATM64:~/shell$ |
全站熱搜
留言列表