This question has three parts, and each of them is simple, but together they are not trivial (at least for me) :)
You need to write a script, which should take as arguments:
- one name of another team
- some arguments for the team
- list of files
Examples:
./my_script head -100 a.txt b.txt ./xxx/*.txt
./my_script sed -n 's/xxx/aaa/' *.txt
etc.
Inside my script for some reason I need to distinguish
- which team
- what are the arguments for the team
- what files
therefore, probably the most standard way to write the above examples:
./my_script head -100
./my_script sed -n 's/xxx/aaa/'
Question1: Is this the best solution?
Processing c. / my _script (first try):
command="$1";shift
args=`echo $* | sed 's/--.*//'`
filenames=`echo $* | sed 's/.*--//'`
"$command" "$args" $filenames
This solution will fail if filenamesit contains spacesand / or '-', for example,
/ some - path / to / more / idiotic file name.txt
Question2: $command $args $filenames ?
Question3: - ?
echo $filenames | $command $args
, , perl?