daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Apr 15th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BASE_DIR=~/Code
  2. function changeProject(){
  3.   if [[ -z $1 ]]; then
  4.     cd $BASE_DIR
  5.   else
  6.     if [ -d $BASE_DIR/$1 ]; then
  7.       cd $BASE_DIR/$1
  8.     else
  9.       select d in $BASE_DIR/*/ "Exit"; do
  10.         case $d in
  11.           "Exit")
  12.             echo "Exiting project selector"
  13.             break
  14.             ;;
  15.           *)
  16.             if [[ -n $d ]]; then
  17.               echo "Switching to project $d ..."
  18.               cd "$d"
  19.               break
  20.             else  
  21.               echo "Invalid selection"
  22.             fi
  23.             ;;
  24.         esac
  25.       done
  26.     fi
  27.   fi
  28. }
  29. alias cx=changeProject
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top