[lug] Bletcherous pipe, FIXME!

Nate Duehr nate at natetech.com
Sat Apr 4 00:37:08 MDT 2009


On Apr 2, 2009, at 8:11 PM, Jeffrey Haemer wrote:

> I don't think there is a cost to using () over {}.
>
> Not much if I'm just doing it once.  I've had it bite me a little in  
> big loops. Contrast these:
>
> sleep 1 && ps
>
> { sleep 1 && ps; }
>
> ( sleep 1 && ps )  # you should see an extra "-bash"
>
> On the other hand, I do shell programming for programmer efficiency,  
> not code efficiency. :-)
> The bigger difference is the environment.  Contrast these
>
> ( cd /tmp; pwd ); pwd      # you're back where you started
> { cd /tmp; pwd; };  pwd    # you've moved
>
> I've used subshells when my code started to become littered with "cd  
> $OLDPWD" or "cd ~-" .



That was cool, Jeffrey.  I like it when these threads make me think!   
(GRIN)

--
Nate Duehr
nate at natetech.com







More information about the LUG mailing list