Skip to content
/ menucd Public template

Directory browser and changer for the command line

License

Notifications You must be signed in to change notification settings

andy5995/menucd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

run shellcheck

menucd

Directory browser and changer for the command line

Requirements

Linux, unix, BSD, MacOS

This script probably won't work from the Windows command line unless you're using WSL or some other modified command line environment.

Usage

Add this function to your environment by editing your ~/.profile, ~/.bashrc, ~/.zshrc, etc (change the path in the code below to match the path to where the menucd.sh script is located):

function menucd () {
  $HOME/scripts/menucd.sh $@
  ret=$?
  if [ -r /tmp/menucd.cd.exit ]; then
          cd "`cat /tmp/menucd.cd.exit`"
          rm /tmp/menucd.cd.exit
  elif [ $ret != 0 ]; then
          echo Fail
  fi
}

Reload ~/.profile (or whichever rc file you edited):

source ~/.profile

Then run menucd. If you run the script (menucd.sh) by itself, it won't work.