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

making `cd` work unquoted



I'm trying to make a function which will accept this:
  cd foo bar baz
and have it acted upon as:
  cd "foo bar baz"

So far, I've run into a few snags.

I don't see how I can make a 'cd' function which will refer to the
'cd' builtin.  Not a big deal, I could call the function 'ccd'.

I can't do something simple like cd "$@"

Quoting with backslashes, like ${(q)@} or single/double quotes isn't
working either. Tildes in the path name are mucking things up.

I tried doing a search-and-replace like so
  var1=${@:gs/ /\\\\ /}
  var2=${var1:gs/~/\\\\~/}
  cd "$var2"
but that's not working either.. which is rather confusing because it
feels like it should.

I went looking for a way to temporarily disable expansion of the
tilde. I figure this is the best route to go at this point.  But after
doing a bunch of searching I haven't found a way. I must be using the
wrong terms to look..


Does anyone have any hints on how I could implement this?



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