On 24May2007 08:11, Kyle Wheeler <[EMAIL PROTECTED]> wrote:
| What about:
|     echo $PATH | while read -d : dir ; do
| ?

Whitespace in the $PATH may be mangled. This:

  echo "$PATH"

will reserve that. I think -d (delimiter, yes?) is less portable than -r
(raw - don't parse backslashes).

Also, on some platforms (SysVish) echo may interpret backslashes as well
(\c  - no newline, \n - a newline char, etc), which is why I went for:

  printf "%s\n" "$PATH"

which avoids that.

Personally I think the IFS based solution suggested elsewhere in the
thread is better - it's totally portable and also faster.

Cheers,
-- 
Cameron Simpson <[EMAIL PROTECTED]> DoD#743
http://www.cskk.ezoshosting.com/cs/

Freedom is the right to be wrong, not the right to do wrong.
- John G. Riefenbaker

Reply via email to