I want to implement a bash script that acts the following way
./script_a.sh script_b.sh $arg1 $arg2 ...
./script_a.sh would invoke script_b.sh on $arg1 $arg2... $argn I don't know how many args there are beforehand. how can this be one?
The $@ contains the list of all arguments passed to the script.
For example consider:
-sh-3.2$ cat scripta
echo $@
"./$@"
-sh-3.2$ cat scriptb
echo hello world $@
-sh-3.2$ bash scripta scriptb 1 2 3 4
scriptb 1 2 3 4
hello world 1 2 3 4
"./$@" calls the script in the argument, scriptb with the remaining arguments 1 2 3 4
hello world 1 2 3 4 is obtained on running the second sript, scriptb
script_b.shalready implemented, or is this a fresh design? If it is, why would you want to do it this way?