nick34992
8/19/2017 - 8:41 PM

Bash: Add Path

Bash: Add Path

#!/bin/bash

echo "Which directory would you like to include with PATH?"
read NewPath

if [ -e "$NewPath" ]; then
  echo "Directory" $NewPath "exists,"
  echo "so" $NewPath "was appended to PATH."
  PATH=$PATH:$NewPath
  export PATH
  echo "Your PATH environment variable is now:"
  echo $PATH
else
  echo "Sorry, I'm afraid that" $NewPath "doesn't exist."
fi

exit 0