Report abuse

add-bin-dir-to-end-of-path


			
#!/bin/sh
#
# Adds /bin to end of PATH
# unless PATH already contains /bin
#
# Execute in the current shell (not a subshell) like this:
#
#   source add-bin-to-end-of-path
# 
# or using the alias to source '.'
#
#    . add-bin-dir-to-end-of-path
#
# The regular expression comparison operator used
# below is only available in bash version 3 and later.
# 
# /bin/sh must run bash v3.0 or later for this script to work.
#
pwd=`pwd`
if [[ "$PATH" =~ "$pwd" ]]
then
  return 0
else
  export PATH=$PATH:$pwd/bin
fi