50 ms·
A better "cd" for bash
- mbillie1 12y agoThis is a cool looking utility, although I imagine you'll face some resistance in replacing a shell essential such as `cd` if for no other reason than fear of bugs. Nice job though! It's cool to see people rethinking shell basics like this.
- arnarbi 12y agoI have functions for two of these that I use all the time: # upcd foo : cd up to the nearest dir matching /foo/ upcd () { cd ${PWD/\/$1\/*/\/$1} } # dncd foo : cd down to the first descendant matching /foo/ dncd () { cd $(find . -type d -name "$1" -print -quit) } If you are in zsh, 'cd /foo/' also does the latter as long as there is only one descendant directory called foo