Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cd: string not in pwd #10092

Closed
Dragonizedpizza opened this issue Aug 8, 2021 · 11 comments
Closed

cd: string not in pwd #10092

Dragonizedpizza opened this issue Aug 8, 2021 · 11 comments
Labels
Resolution: duplicate This issue or pull request already exists Support Request for support

Comments

@Dragonizedpizza
Copy link

Dragonizedpizza commented Aug 8, 2021

Describe the bug

When I run cd Hurr*, I get the error cd: string not in pwd: Hurricano.

Steps to reproduce

  1. Clone a repository via git.
  2. Attempt to cd into it with *, like cd SomeDir*, where SomeDir is SomeDirectory.

Expected behavior

Expected it to change into the correct directory.

Screenshots and recordings

image

OS / Distro

Ubuntu 18.04

Zsh version

Zsh 5.4

Terminal emulator

Gnome Terminal

If using WSL on Windows, which version of WSL

No response

Additional context

I use zsh-autocomplete.

@Dragonizedpizza Dragonizedpizza added the Bug Something isn't working label Aug 8, 2021
@rwmitchell
Copy link
Contributor

Just curious, why are you using a wildcard (cd only takes 1 arg) when [TAB] (still a single character and '*' is actually 2, [SHIFT]-8) should expand to the proper thing?

@mcornella
Copy link
Member

mcornella commented Aug 8, 2021

There are many issues like this one. cd expects one argument, if you pass a glob that expands to more than one that's the behavior you get.

Duplicate of #6452 #9354

@mcornella mcornella added Support Request for support and removed Bug Something isn't working labels Aug 8, 2021
@Dragonizedpizza
Copy link
Author

There are many issues like this one. cd expects one argument, if you pass a glob that expands to more than one that's the behavior you get.

but it doesn't expand to more than one

@rwmitchell
Copy link
Contributor

There are many issues like this one. cd expects one argument, if you pass a glob that expands to more than one that's the behavior you get.

but it doesn't expand to more than one

My own testing shows that not to be the case. Using cd with a wildcard in a directory name that matches a single entry, works. Giving cd multiple arguments gives the error you reported. Again, just use [TAB] - fewer keystrokes and it'll show any additional matches.

@rwmitchell
Copy link
Contributor

There are many issues like this one. cd expects one argument, if you pass a glob that expands to more than one that's the behavior you get.

Surprisingly (to me) that isn't true. It'll take 2:

image

@Dragonizedpizza
Copy link
Author

There are many issues like this one. cd expects one argument, if you pass a glob that expands to more than one that's the behavior you get.

but it doesn't expand to more than one

My own testing shows that not to be the case. Using cd with a wildcard in a directory name that matches a single entry, works. Giving cd multiple arguments gives the error you reported. Again, just use [TAB] - fewer keystrokes and it'll show any additional matches.

All I did was clone a repo (which has a 1 word name), and couldn't cd into it with a wild card.

@mcornella
Copy link
Member

Surprisingly (to me) that isn't true. It'll take 2:

See the old new form of cd. That's the behavior on more than one arguments. If there is no old part in pwd, you get the mentioned error.

All I did was clone a repo (which has a 1 word name), and couldn't cd into it with a wild card.

Wasn't there another file or directory starting with Hurr? What does print -l Hurr* show?

@mcornella mcornella added the Resolution: duplicate This issue or pull request already exists label Aug 10, 2021
@Dragonizedpizza
Copy link
Author

Surprisingly (to me) that isn't true. It'll take 2:

See the old new form of cd. That's the behavior on more than one arguments. If there is no old part in pwd, you get the mentioned error.

All I did was clone a repo (which has a 1 word name), and couldn't cd into it with a wild card.

Wasn't there another file or directory starting with Hurr? What does print -l Hurr* show?

image

@rwmitchell
Copy link
Contributor

And that is why it is failing which is exactly what we’ve been saying but you refused to read.

@Dragonizedpizza
Copy link
Author

I thought it only picks the first case, sorry for all the trouble 😅

@rwmitchell
Copy link
Contributor

Reread all the responses carefully for any indication your expectations match the answers given. You completely avoided trying any of the suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: duplicate This issue or pull request already exists Support Request for support
Projects
None yet
Development

No branches or pull requests

3 participants