# "$#" number of args
# "$@" all args
[jerry@localhost bin]$ cat args_test.sh
#!/bin/bash
echo "This is all parameters: $@"
echo "This is parameter one: $1"
echo "This is the parameters number: $#"
[jerry@localhost bin]$ ./args_test.sh hi hello how
This is all parameters: hi hello how
This is parameter one: hi
This is the parameters number: 3
# "$@" all args
[jerry@localhost bin]$ cat args_test.sh
#!/bin/bash
echo "This is all parameters: $@"
echo "This is parameter one: $1"
echo "This is the parameters number: $#"
[jerry@localhost bin]$ ./args_test.sh hi hello how
This is all parameters: hi hello how
This is parameter one: hi
This is the parameters number: 3
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23895263/viewspace-697722/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23895263/viewspace-697722/