Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: cd x x.something



On 09/26/2017 05:56 PM, Roman Neuhauser wrote:
can you elaborate how?  it surely should:

I'll have to look at my command history at work where I tried this.

$ mkdir omg omg.wtf
$ cd omg
$ pwd
/home/roman/omg
$ cd $PWD.wtf
$ pwd
/home/roman/omg.wtf

That works for me at home.

I'm guessing that I used "omg.wtf" instead of "$PWD.wtf". Which leads me to think that this is something special that acts on the PWD environment variable.

Or there's some sort of environment variable permutation that I'm not aware of. Which is completely possible.

`cd foo bar` does not "move laterally", it's like `cd ${PWD:s#foo#bar}`,
except `foo` is not treated as a glob.  this doesn't look lateral to me:

$ mkdir x
$ cd x
$ pwd
/home/roman/x
$ mkdir -p .$PWD
$ cd / ./
$ pwd
/home/roman/x/home/roman/x

Okay, I see what you're saying.

% cd /dev/shm
% mkdir omg omg.wtf
% cd omg
% pwd
/dev/shm/omg
% cd omg omg.wtf
% pwd
/dev/shm/omg.wtf

That's why I was saying laterally.

no, i meant what i wrote: since the second directory differs from $PWD
only in the ".bak" suffix, `cd $PWD.bak` will have the desired effect.

Fair.

Thank you for the explanation Roman.



--
Grant. . . .
unix || die



Messages sorted by: Reverse Date, Date, Thread, Author