[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: {} as shell variable
From: |
Rhys Ulerich |
Subject: |
Re: {} as shell variable |
Date: |
Wed, 23 Oct 2013 17:02:47 -0500 |
> 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?
What are the collection of shell-supported operations you anticipate
being useful in this context? Looking at
http://tldp.org/LDP/abs/html/parameter-substitution.html, it appears
bash supports only a small family of operations for which I can
imagine the hypothetical $P being useful. Directly writing {:0:6}/{}
or {//:0:6}/{//} might be cleaner and more unified than relying on the
incoming environment via something like '"${P:0:6}/$P'. In
particular, it requires less quotation.
- Rhys