[lug] Bletcherous pipe, FIXME!

Jeffrey Haemer jeffrey.haemer at gmail.com
Thu Apr 2 20:11:33 MDT 2009

> I'm sure bash has had two or three major versions since then. :)

Bash 4 was released in the last few weeks, and includes several fun new
features!  I have seen it hiccup a couple of times, so it may not be ready
for mission-critical work today.  The bash maintainer, Chet Ramey, fixes
shell bugs pretty fast, though.  By the time it shows up, packaged, in your
distro, it should be fine.

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 ~-" .

Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell]
303-997-1219 [Google Voice]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20090402/c8cde634/attachment.html>

More information about the LUG mailing list