Okay, I did a little more homework on Bourne and found you are right; a trailing colon in the $PATH does indeed put the current directory at the end, and a double-colon in the path does indeed count as the current directory. I knew neither of these things. This mostly retracts my suggestions.
> > 30 case $PATH in > > 31 *::) : "not *DIR:" ;; > > 32 *:) PATH="$PATH:" ;; > > 33 esac Line 31 is still messy and counter-intuitive. How about this instead: case $PATH in *[^:]:) PATH="$PATH:" ;; esac Alternatively, you could remove lines 30-33 and stick a trailing colon on the end of line 46, like: for ELEMENT in $PATH:; do which would have the same effect, though it would run the loop an extra time if there is an odd number of trailing colons AND there are 3+ AND the item either isn't in the path or the -a flag was given. > > If you really want to be able to handle a corner case like that, add a > > third test to line 57 (line 43 on my patched version) to test for > > '[ -n "$ELEMENT" ]' (sans single-quotes). This goes third so that it is > > never used except in these rare corner cases (due to short circuiting). > > I'm not sure how rare this is. Any further thoughts? Disregard. The code is needed as-is due to the empty string's need for interpretation as the current directory. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]