Tony Ruth
Tony Ruth

Reputation: 1408

Expand by Arguments, UNIX

I frequently run into commands which do not take multiple arguments well. I would like to know if there is a standard shell command for the following operation. I Named it expand, but I know there is already a different command called expand:

expand myCommand -option1 -option2 arg1 arg2 arg3 | suffix_operations_or_&

when run it would turn the above line into this:

myCommand -option1 -option2 arg1  | suffix_operations_or_&
myCommand -option1 -option2 arg2  | suffix_operations_or_&
myCommand -option1 -option2 arg3  | suffix_operations_or_&

Is there a name for this operation?

Upvotes: 0

Views: 29

Answers (1)

Barmar
Barmar

Reputation: 782148

Easiest way is a simple for loop:

for i in arg1 arg2 arg3
do
    myCommand -option1 -option2 "$i" | suffix_operations_or_ &
done

Upvotes: 4

Related Questions