So,
cd ..
moves back into the parent directory.
I'd like to add functionality so that I could type...
cd ...
... and move into the parent directory's parent directory.
and consequently move up an additional tier for each extra .
The idea came from an SO answer about a script called 'up' which should do essentially the same thing. But I'm curious if it'd be possible to just add to the cd
command.
After a quick search I've noticed that cd
is a bash builtin so I don't think it'll be possible to edit any original code. Would it be possible to create a new cd
(.sh) script that executes in place of the builtin cd
command when valid arguments are provided? What other ways might this be accomplished by?
Note: this is more for learning than practical application, I just think it'd be a cool thing to do. Thanks!