<<< Date Index >>>     <<< Thread Index >>>

Re: when using `which` send errors to /dev/null



On Thursday, May 24 at 02:40 PM, quoth Cameron Simpson:
On 23May2007 21:21, David Champion <dgc@xxxxxxxxxxxx> wrote:
| * On 2007.05.23, in <20070523233131.GA22736@xxxxxxxxxxxxxxx>,
| * "Cameron Simpson" <cs@xxxxxxxxxx> wrote: | > printf "%s\n" "$PATH" | tr : '\012' | while read -r dir; do
| > Unless that breaks on Solaris, which it may:-(
| | I don't think -r is present in a strict Bourne shell's "read".
| Solaris's gives "-r: is not an identifier", but I don't expect that it's
| limited to Solaris.

I think it's POSIX standard, but not SysV Bourne shell (sorry, no chapter
and verse to hand). Solaris ships with the latter as /bin/sh.

But as you point out, a single exception may be enough.

What about:

    echo $PATH | while read -d : dir ; do

?

~Kyle
--
To invent, you need a good imagination and a pile of junk.
                                                   -- Thomas Jefferson

Attachment: pgp4XqZS3qbxv.pgp
Description: PGP signature