Linux 中 使用set 给shell脚本设置参数
001、
[root@PC1 test1]# ls ## 准备两个测试文件 a.sh b.sh [root@PC1 test1]# cat a.sh ## a文件 #!/bin/bash echo $* [root@PC1 test1]# cat b.sh ## b文件 #!/bin/bash set one two three echo $* [root@PC1 test1]# bash a.sh [root@PC1 test1]# bash a.sh one two three ## 执行a文件,需要位置参数 one two three [root@PC1 test1]# bash b.sh ## b文件不需要,因为使用set指定了参数 one two three

。

浙公网安备 33010602011771号