> how can i add a path (like "." or "/Users/Shared/bin") to the $PATH
> environment var only when its not yet in there?
> the nicest would be something where i can give the two new paths in one
> string as input (eg. ".:/Users/Shared/bin") and $PATH as another input.
One possibility (with no error checking):
#!/bin/sh
addToPath()
{
case :$1: in
*:$2:*)
;;
*) PATH=$PATH:$2; export PATH
;;
esac
Quote:}
addToPath $1 $2
echo $PATH
Of course, this would have to be sourced rather than run as a command
to affect the calling process.
Joe
--
Everyone in this room is wearing a uniform, and don't kid yourself.
- Frank Zappa