I'm a csh user. In my .cshrc or .login files, I'd like to add certain directories to my search PATH, but I'd first like to check if those directories are already in the search path before attempting to add them (so don't add the same directory twice). The following isn't working
Code:
if ( "${PATH}" !~ ~/bin ) then
setenv PATH "${PATH}:$HOME/bin"
endif
The problem is that the if-statements always evaluates to TRUE, meaning that ~/bin is always added to the path, even if it's already in the path.
What am I doing wrong in the above regulat expression, or alternatively, what's an easy way to accomplish the same thing?