Re:Some Useful Bash Aliases – Chuck Carroll
by dw_arthur on Monday December 25, 2023 @06:28PM
(#38767343)
my version of ..
so you can just type .. to go up once or .. [word] to go up twice and so on
[ Parent
| on HN ]
Re:Some Useful Bash Aliases – Chuck Carroll
by JNRowe on Monday December 25, 2023 @11:06PM
(#38768835)
That seems potentially unpredictable versus building the string and calling cd once. For example, if you use direnv-type tools there may be side-effects along the route¹. zsh users could have state changing via the chpwd functions too, although that could be mitigated with "cd -q" at least.
Obviously, it might not be an issue for your use, but just noting a potential gotcha if I were to lift it for example.
[ Golf-y zsh, because vacation time and AoC has finished: ..() { cd ../${(pj:/:)${@/*/..}} } ]
¹ even just expensive setup/teardown delays would feel odd*