codefire@aliyun:~/workspace/shell_script$ ./success_test.sh "ls -l"
The program params list:ls -l The program params count is 1 The params list in test is ls -l The params count in test is 1 The $1 cmd is ls -l ==========ls -l execute output below ======== total 4 -rw-rw-r-- 1 codefire codefire 0 Nov 19 14:50 a.txt -rwxrwxrwx 1 codefire codefire 572 Nov 19 15:37 success_test.sh ==========ls -l execute output finish ======== ls -l executed successfully ============================================ The params list in test is ls -l The params count in test is 2 The $1 cmd is ls ==========ls execute output below ======== a.txt success_test.sh ==========ls execute output finish ======== ls executed successfully============================================
测试a+b
codefire@aliyun:~/workspace/shell_script$ ./success_test.sh "a+b" The program params list:a+b The program params count is 1 The params list in test is a+b The params count in test is 1 The $1 cmd is a+b ==========a+b execute output below ======== ./success_test.sh: line 8: a+b: command not found ==========a+b execute output finish ======== a+b executed failed ============================================ The params list in test is a+b The params count in test is 1 The $1 cmd is a+b ==========a+b execute output below ======== ./success_test.sh: line 8: a+b: command not found ==========a+b execute output finish ======== a+b executed failed ============================================