-
6
- #1
A recent post has prompted me to share something with you all. To navigate to frequently-used directories, I have the following line in my .profile…
alias ycd='select ID in $(<$HOME/.ycd_list);do [ $ID ] && cd $ID;break;done'
… and I maintain a list of directories in $HOME/.ycd_list
Use it like this…
[tt]
$ ycd
1) /very/long/path/to/some/working/directory
2) /extremely/long/path/name
3) /etc/you/get/the/idea
#? 2 [/tt][gray] <<-- note: I keyed 2 here, use 0 or q to quit[/gray]
[tt] $ pwd
/extremely/long/path/name
[/tt]
Note that it only works with ksh-based shells which have a select function. Take a look and the manual pages for a proper description of select and the PS3 prompt.
alias ycd='select ID in $(<$HOME/.ycd_list);do [ $ID ] && cd $ID;break;done'
… and I maintain a list of directories in $HOME/.ycd_list
Use it like this…
[tt]
$ ycd
1) /very/long/path/to/some/working/directory
2) /extremely/long/path/name
3) /etc/you/get/the/idea
#? 2 [/tt][gray] <<-- note: I keyed 2 here, use 0 or q to quit[/gray]
[tt] $ pwd
/extremely/long/path/name
[/tt]
Note that it only works with ksh-based shells which have a select function. Take a look and the manual pages for a proper description of select and the PS3 prompt.