[Bash][function] Passing parameters to a bash function Posted by Computer Newbie on 晚上9:48 in bash script, Linux, Ubuntu / No comments #!/bin/sh foo 1 # this will fail because foo has not been declared yet. foo() { echo "Parameter #1 is $1" } foo 2 # this will work.Output : happy@happy-laptop:~/Desktop/test2$ sh test3.sh test3.sh: 3: foo: not found Parameter #1 is 2 Reference : Passing parameters to a bash function Share This: Facebook Twitter Google+ Stumble Digg 以電子郵件傳送這篇文章BlogThis!分享至 X分享至 Facebook
0 意見:
張貼留言