-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Bruno Haible on 6/23/2007 1:09 PM: > But then use IFS (so that PATH elements containing spaces are handled > correctly), ignoring empty fields from the cases C and D. In summary, > something like this: > > pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
Or, to avoid the sed when possible, you could do case `echo ":$PATH:" in *::*) pathx=`echo ":$PATH:" \ | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'` ;; esac > save_IFS=$IFS > IFS=: > for d in $pathx; do > IFS=$save_IFS > ... > done > IFS=$save_IFS > - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGfZEf84KuGfSFAYARAk4kAJ4pZezID/Dk18L0YboapOxYWl2HlwCfUX0s nh/rxU1SZK+CMhQLZqmJMRc= =QT3X -----END PGP SIGNATURE-----