Monday, August 9, 2010

Better than bash?

I avoided bash (the GNU extension of the Bourne shell) for a long time for one reason:
   prog1 |& prog2
I have always been annoyed by the bash equivalent:
  prog1 2>&1 | prog2
When I learned that a new version of bash allowed the |&, I made the switch and have been very happy.

Recently, I learned about something that could be better than bash: rc.  The docs for rc are very interesting and amply justify the switch.

Instead of switching immediately, I am moving gradually by putting
  SHELL=rc
into my makefiles.  So far, I am very happy with it.

There is one caveat, pointed out by uriel on reddit:
I suspect the 'rc' in MacPorts is an old re-implementation which has some serious flaws.
The original rc, plus all the great Plan 9 commands are available as part of Plan 9 from User Space which runs great on OS X (Russ Cox, the author, is also one of the main Google Go developers, and uses OS X as his main development platform, with p9p's acme of course ;)).

1 comment:

  1. One other thing from reddit...

    Question:

    Hey uriel - I've found tons of references saying "you can use readline with rc", but I downloaded plan 9 from user space, installed it all, and can't find anywhere where this is a compile time option. Plus there's no configure script, which is lovely, but that also means I have no idea how to turn on --with-readline or some such thing.


    Answer (from case-o-nuts):

    install rlwrap, and run rlwrap rc (works for any program, not just rc)

    ReplyDelete