The string substitution syntax ${FOO/bar/mumble}, which returns $FOO, but with mumble substituted for bar, solves my problem. For example, if I'm in the tree /home/jsh/tree1/a/b/c/d, and I want to pop over to /home/jsh/tree2/a/b/c/d, I just say
$ pushd ${PWD/tree1/tree2}or even
$ cd ${PWD/1/2}Presto! I'm there faster than you can say, "xyzzy." Or, at least as fast.
Not only am I in the new tree, but now pushd, with no arguments, (or cd - ) takes me back and forth.
No comments:
Post a Comment