parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Easy way to append a list of arguments


From: Glen Huang
Subject: Easy way to append a list of arguments
Date: Mon, 29 May 2017 11:46:57 +0800

Hi,

I'm looking for a way to easily append a list of arguments to the ones from 
stdin

{ echo 1 2; echo 3 4; } | parallel -k echo :::: - ::: a ::: b

This gives 

1 2 a b
3 4 a b

as expected.

But I'd like to do something like this

foo() {
        { echo 1 2; echo 3 4; } | parallel -k echo :::: - ::: "$@"
}

and make the arguments passed to foo to be appended like that in the previous 
case.

I can somewhat achieve that by using 

{ echo 1 2; echo 3 4; } | parallel -k echo {} "$@" :::: -

But there is the quoting issue that passing foo "a b" would result in two 
arguments, and also mentioned in my previous mail, foo 港 would fail.

I'm looking for something like

{ echo 1 2; echo 3 4; } | parallel -k echo :::: - :::@ "$@"

where :::@ would simply append the following arguments.

Does something like this already exist in parallel or is there another way to 
do that?

Regards
Glen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]