Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Go upwards the path until the basename is equal
- # to your argument.
- function cdp {
- CURRENT=$(basename $PWD)
- until [ $CURRENT == "$*" ]; do
- cd ..
- CURRENT=$(basename $PWD)
- done
- }
- _cdp() {
- local cur=${COMP_WORDS[COMP_CWORD]}
- COMPREPLY=( $(compgen -W "${PWD//\// }" $cur) )
- }
- complete -F _cdp cdp
Add Comment
Please, Sign In to add comment