3 comments

[ 5.4 ms ] story [ 20.0 ms ] thread
Note, if you are using Bash, then the $CDPATH variable, already built in to Bash, will let you do everything your script provides.
The CDPATH variable tends to be somewhat ambiguous, to me at least. Appreciate for your comment though!
The trick is you have to set it one level up from where you want the expansions to appear. So to allow "cd Downloads" to find /home/user/Downloads, you need to set CDPATH to /home/user

Now all directorys in /home/user/* become match points for "cd dirname".