Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cd () {
- emulate -LR zsh
- if [[ $# -ge 3 ]]; then
- echo cd: too many arguments >&2
- return 1
- elif [[ $# -eq 2 ]]; then
- ## builtin cd $1 $2
- local newdir=${(S)PWD//$1/$2}
- echo $newdir
- builtin cd $newdir
- elif [[ $# -eq 1 ]]; then
- if [[ ! -d $1 && -d $1:h ]]; then
- echo $1:h
- builtin cd $1:h
- else
- builtin cd $1
- fi
- else
- builtin cd
- fi
- }
Add Comment
Please, Sign In to add comment