Quote: http://www.study-area.org/tips/shell_13q.txt
#!/bin/bash
my_fun() {
echo “$#”
}echo ‘the number of parameter in “$@” is ‘$(my_fun “$@”)
echo ‘the number of parameter in “$*” is ‘$(my_fun “$*”)
sh script.sh
the number of parameter in “$@” is 0
the number of parameter in “$*” is 1
sh script.sh 1 2 3
the number of parameter in “$@” is 3
the number of parameter in “$*” is 1
sh script.sh 1 “2 3”
the number of parameter in “$@” is 2
the number of parameter in “$*” is 1
留言