On Feb 10, 2008, at 11:59 AM, Gorka Guardiola wrote:

On Feb 9, 2008 8:53 AM, Hongzheng Wang <[EMAIL PROTECTED]> wrote:
Hi all,

2. In non-interactive use (script programming), what's the main
advantages of rc over sh/bash?

Things I like of rc:

In both interactive and non-interactive, spaces do not bite you in rc.

in bash

if [ $bla -eq $otherbla ] ; fi endif... ahhh, I can´t remember the
syntax and get the spaces wrong,

The proper is

if [ $bla -eq $otherbla ]; then
        :
fi

The advantage of rc is that that : is not necessary!

Oh, and let's not forget what happens when bla or otherbla is nil! In rc,
        if (~ $bla $otherbla) { }
is all that is needed - no hooks.

Someone else said it, only one quoting simbol
(what does " bla \$e'o" do on bash?, I just invented it, but every time I see
double qoutes I start trembling)

It produces the string ' bla$e''o' in rc syntax. The one thing I like about two quoting styles in the Bourne shell is that I can use escape sequences. The one thing I dislike about bash is that bash fucks up this quote system.


And here is my 2 cents:

- List objects are STANDARD (bash/kornshell arrays are not)
        x=(a b c)
- The seq statement is standard
        for (i in `{seq 1 10}) echo $i
- Removable functions
        fn x { echo 4 }
        fn x
        x=4
- >[] piping syntax is much more intuitive
- |[2] to pipe arbitrary file descriptors. One time, to skim through errors from gcc to find out if I had mistyped a member of a struct, I had to do
        gcc a_file_in_my_os.c 2>&1 | grep member
  In rc:
        8c a_file_in_my_os.c |[2] grep member
- Empty condition bodies! while(){echo y} is the yes command. It's much more terse.
- aux/getflags is faster than while getopt (no loop involved)
My next plan is to rewrite all of /rc/bin to use aux/getflags. Any objections? - The trap statement is gone - goodbye confusing hooks and no way of telling signal 1 from a command/function called 1
        Instead, you define functions sigterm and sigkill (I think)

And what I dislike:
- >[2=] is not the same as >[2]/dev/null (some programs crash with the former

Reply via email to