parallel
[Top][All Lists]
Advanced

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

{} as shell variable


From: Ole Tange
Subject: {} as shell variable
Date: Wed, 23 Oct 2013 23:52:29 +0200

I just read:

http://stackoverflow.com/questions/19529607/how-to-pass-part-of-an-argument-to-a-gnu-parallel-command/19529783#19529783

Here it seems it would be helpful if {} was also accessible as a shell
variable (e.g. as $P):

parallel '/some/binary "${P:0:6}/$P"' ::: 20131017 20131018

I have considered whether the modified replacement strings ( {.}, {/}
{//} and {/.} ) should have their own shell variable, but I am
thinking the primary reason why you want to use the shell variable is
so you can do some manipulation as above, and then it may be easier to
read if there is only one special variable.

IF it is a good idea what should the variable be named?

$PARALLEL_ARG is illustrative and easy to understand, but very long.
$P is very short, but if $P is used by the user self, he will be
surprised that $P is suddenly set.
$_P is reasonably short and looks like something out of the ordinary,
but might be confused with $_.

parallel  '/some/binary "${_P:0:6}/$_P"' ::: 20131017 20131018

Your comments?


/Ole



reply via email to

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