2 ms·
I've experimented in this area. I once made a "pcd" (parent cd). The idea is that "cd" (if relative) changes the last component of your directory: if you're in
by kazinator 3y ago
I've experimented in this area. I once made a "pcd" (parent cd). The idea is that "cd" (if relative) changes the last component of your directory: if you're in foo/bar and type "cd baz/xyzzy", then the /bar component is rewritten to /baz/xyzzy".
My "pcd" would similarly rewrite the parent component instead. If you're in "a/b/c" and do "pcd x" you change to "a/x/c"; and "pcd x/y" would change to "a/x/y/c". Useful for when you have some similar directories with parallel structures.
I gave it a numeric argument defaulting to 1. "pcd 0" is like cd, "pcd 1" is like pcd, and then higher integer switch higher components.