#NOTE: You MUST 'source' this. #DON'T: !/bin/bash #This is to remove the Borland compiler paths from PATH #Install paths can be something like: # # c:\PROGRAM\BC31_DOS\BIN # c:\PROGRAM\BC5\BIN # # which will contain / instead of \ in bash. # #grep PATTERN to look for (and remove) sd="/bc" hd=".rm_bc_paths:" #lets have a copy of the current PATH echo $PATH >/tmp/PATH #replace ':' with linefeeds tr ':' '\n' /tmp/PATHLF #remove lines that contains $sd grep -v -i "$sd" /tmp/PATH_CLEANLF1 #remove lines referring to /cygdrive/c grep -v -i "/cygdrive/c" /tmp/PATH_CLEANLF #restore :'s as separator, # could be done w 'tr', but more control is required cat /tmp/PATH_CLEANLF | ( read d; while [ ! -z "$d" ] ;do echo -n "$d"; read d; if [ ! -z "$d" ] ;then echo -n ":"; fi; done ) >/tmp/PATH_CLEAN #set the new clean path export PATH=`cat /tmp/PATH_CLEAN` #inform user... diff -u0p /tmp/PATHLF /tmp/PATH_CLEANLF >/tmp/PATH_REMOVED if [ `wc -w