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

Re: cd x x.something



# gtaylor@xxxxxxxxxxxxxxxxxx / 2017-09-26 13:47:23 -0600:
> On 09/26/2017 12:50 PM, Roman Neuhauser wrote:
> > cd $PWD.bak
> 
> That doesn't work for me.

can you elaborate how?  it surely should:

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

> -  It's also one directory, not the two that I
> think is needed to move laterally.

`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

> Did you by chance mean the following:
> 
> cd $PWD{,.bak}
> 
> Which expands to two directories, the first with no suffix and the second
> with the .bak suffix?

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.

-- 
roman



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