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

When i try to cd dir I get an error 'cd: string not in pwd: foo' #6452

Closed
keevvinc opened this issue Nov 24, 2017 · 13 comments
Closed

When i try to cd dir I get an error 'cd: string not in pwd: foo' #6452

keevvinc opened this issue Nov 24, 2017 · 13 comments

Comments

@keevvinc
Copy link

I know this is almost the same issue as #4513 , however I do not have set an alias for 'cp' ..
Any solutions? Until recently I could cd directories that contain space without escaping them, nor putting the path into " " ..

@dalibran
Copy link

dalibran commented Apr 11, 2018

I'm encountering the same error. The directory I'm trying to cd into is labeled '2018.02 Spring.' I don't have an alias set up in my .zshrc file. The specific error I'm getting is...

screenshot 2018-04-11 12 52 03

I was able to access the folder by escaping the space with a \

@mcornella
Copy link
Member

mcornella commented Apr 17, 2018

You have to escape the spaces in an argument, otherwise cd will see it as two arguments, which runs the second version of the cd command: cd old new, which is probably not what you intended:

The second form of cd substitutes the string new for the string old in the name of the current directory, and tries to change to this new directory.

Not an issue.

@dalibran
Copy link

thanks! @mcornella

@didimedina
Copy link

@mcornella thanks!

@redoz94
Copy link

redoz94 commented Dec 13, 2019

So what if there's spaces in the name of a directory?

@mcornella
Copy link
Member

Escape the argument, i.e. cd "name of directory".

@UsmanButt93
Copy link

how we can access the directory which has spaces in name?
it would take too long every time to write for each directory in order to access it.
does it have any shortcut?

@mcornella
Copy link
Member

Use tab completion, i.e. start to type the directory, then press TAB to complete the name.

@Amir-mirgeloybayat
Copy link

@UsmanButt93 If you're using a mac os:
you can go to preferences > keyboard > shortcuts > go to the Files and folders drop-down menu and check "new terminal at folder"
Now if you go to a specific path/ folder and right-click on it, you can choose "new terminal at folder" and you can verify that you're in the right place by pwd command

happy coding!

@asaalim

This comment was marked as duplicate.

@carlostrujilloneyra

This comment was marked as duplicate.

@IdrissTheCat

This comment was marked as duplicate.

@Ankit-Yaduwanshi

This comment was marked as duplicate.

@ohmyzsh ohmyzsh locked as resolved and limited conversation to collaborators Feb 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests