4 ms·
Funnily enough, I did the exact same thing but for zsh's two-argument cd: cd() { if [[ -n "$2" && "$1" != "--" ]]; then builtin cd "${PWD/"$1"/"$2"}"; else b
by Dagger2 8y ago
Funnily enough, I did the exact same thing but for zsh's two-argument cd:
cd() { if [[ -n "$2" && "$1" != "--" ]]; then builtin cd "${PWD/"$1"/"$2"}"; else builtin cd "$@"; fi; };
It's niche functionality, but super useful when you hit its niche:
user@machine:/usr/src/linux-kbuild-4.9/scripts/mod$ cd 4.9 4.8
user@machine:/usr/src/linux-kbuild-4.8/scripts/mod$
I'll leave combining these two as an exercise for the reader.