[Techtalk] weirdness piping to a variable

R. Daneel Olivaw rdaneel.olivaw at gmail.com
Sun Sep 22 16:39:56 UTC 2013


Hi there,

Le 2013-09-20 06:05, Miriam English a écrit :

>> some_var=$(command | command | command)
>
> It is similar to what I usually do too, though I tend to use backticks.
> (I wonder if there is an advantage to one way rather than the other.)

In fact back-ticks work perfectly well, but I tend to use the other form 
as back-ticks cannot be nested, while $() can. Also, back-ticks have 
some graphical proximity with apostrophes, that is a bit disturbing for 
a native French writer ;)
It's just as preferring curly braces around shell variables, it's a kind 
of coding style.

As for the discussion about how variables (and some other things) are 
handled in particular ways on unix/linux, I may agree to some extent, 
but am sure the past unix-wars have taught us well how to stay out of 
trouble :p

R. Daneel Olivaw,
The Human Robot Inside.


More information about the Techtalk mailing list