[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

cd as much as possible



Is it possible to change the behaviour of the "cd" command or have a
new command which works like cd but with an extra feature so that it
goes into the directory as deep as possible.

For example, if I do
  cd a1/a2/a3/a4

If all the directories are present, we cd into a1/a2/a3/a4.
If all the directories are present except for a4, we cd into a1/a2/a3
If a1 and a2 directories exist but not a3, we cd into a1/a2
etc.,

If it matters, I am using zsh on a machine running Debian Jessie. But
I am open to experiment with other shells if needed. Any thoughts?

thanks
raju
-- 
Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog


Reply to: