tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ Files with space

Files with space ▻

Files with space

In article <XU4X3.49507$it.1166091@news2.rdc1.on.home.com>,
Dave Brown <dagbrown@home.com> wrote:
>Your own ignorance does not mean that rc is a better shell.  It
>just means that you don't know how to use your tools.

These are both legal Bourne shell syntax.

    for i in *; do ls $i; done

    for i in *; do ls "$i"; done

The former works almost all the time (see my comment about vicious
circles).  Many naive programmers will use it.  Many experienced
programmers, who have a good grasp of Bourne's complex quoting rules,
will miss the mistake---not in this trivial example, but when the
quoting is buried inside deeper layers.

I didn't claim that rc is a better shell.  That depends on your
criteria.  (If "ubiquity" is important, it clearly isn't better.)  But
I do claim that rc's syntax avoids a number of Bourne shell pitfalls
like this one.  This makes rc easier to learn, and an easier language in
which to write correct programs.

Tim.
--
Tim Goodwin   | "People think [ W. Gibson is ] hi-tech because his prose
Leicester, UK | is as pleasant to read as a C++ program." -- JT

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: Files with space
Date: 15 Nov 1999 13:39:24 -0000
Organization: University of Leicester, UK
Message-ID: <80p2f2$1p1$1@ltpcg.star.le.ac.uk>
References: <80c4uc$15p$1@nnrp1.deja.com> <80e69d$hco$1@nnrp1.deja.com>
  <80hcne$b5d$1@ltpcg.star.le.ac.uk>
  <XU4X3.49507$it.1166091@news2.rdc1.on.home.com>

△ comp.unix.shell △

◅ Files with space

Files with space ▻