我想要实现的行为方式如下bash脚本,动态调用参数作为另一个bash脚本
./script_a.sh script_b.sh $arg1 $arg2 ...
./script_a.sh将调用上$ ARG1 $ ARG2 script_b.sh bash脚本... $ argn 我不知道之前有多少个参数。这怎么可能是一个?
我想要实现的行为方式如下bash脚本,动态调用参数作为另一个bash脚本
./script_a.sh script_b.sh $arg1 $arg2 ...
./script_a.sh将调用上$ ARG1 $ ARG2 script_b.sh bash脚本... $ argn 我不知道之前有多少个参数。这怎么可能是一个?
试试这个作为包装:
#!/bin/bash
"[email protected]"
的[email protected]
包含传递给脚本的所有参数列表。
例如考虑:
-sh-3.2$ cat scripta
echo [email protected]
"./[email protected]"
-sh-3.2$ cat scriptb
echo hello world [email protected]
-sh-3.2$ bash scripta scriptb 1 2 3 4
scriptb 1 2 3 4
hello world 1 2 3 4
"./[email protected]"
调用脚本中的说法,scriptb
与其余的参数1 2 3 4
hello world 1 2 3 4
上运行的第二sript获得,scriptb
是'script_b。 sh'已经实施了,还是这是一个全新的设计?如果是这样,你为什么要这样做? – ghostdog74 2014-10-30 07:08:56