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

Re: cannot `cd $_` to $_ containing spaces



On Tue, Oct 13, 2020 at 9:31 PM Soren Roth <sorenoid@xxxxxxxxx> wrote:
> I made a directory with a space in the name, and tried to cd into it using $_, and failed.

You probably have the SH_WORD_SPLIT option enabled. This option causes
field splitting to be performed on unquoted parameter expansions, like
in POSIX sh. You can turn it off by adding `unsetopt SH_WORD_SPLIT` to
~/.zshrc. Otherwise you need to quote parameter expansions to prevent
field splitting (again, like in POSIX sh).

    cd "$_"

Roman.




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