简体   繁体   中英

-bash: cd: app: No such file or directory

I simply changed the name in finder and now when I use a command in terminal, this is the error I keep receiving. I've tried to look at all the other cases of the same error but they all pertain to different solutions that don't work. The path is clearly correct because when I try to cd into the directory, I'm already in the directory it is contained in.

Johns-MacBook-Air:SongAnalysisSentiment johnanukem$ cd app
-bash: cd: app: No such file or directory
Johns-MacBook-Air:SongAnalysisSentiment johnanukem$ ls
README          app             sentiments.csv      songdictionary.py
Johns-MacBook-Air:SongAnalysisSentiment johnanukem$ ls -lah
total 776
drwxr-xr-x   8 johnanukem  staff   272B Nov 14 02:38 .
drwx------+ 39 johnanukem  staff   1.3K Nov 14 02:38 ..
-rw-r--r--@  1 johnanukem  staff   6.0K Nov 14 01:39 .DS_Store
drwxr-xr-x  16 johnanukem  staff   544B Nov 14 02:43 .git
-rw-r--r--   1 johnanukem  staff    35B Nov 14 01:38 README
drwxr-xr-x   8 johnanukem  staff   272B Nov 14 02:38 app 
-rw-r--r--   1 johnanukem  staff   370K Nov 14 01:49 sentiments.csv
-rw-r--r--   1 johnanukem  staff   1.3K Nov 14 02:29 songdictionary.py

键入cd ap ,然后按[Press Tab]自动完成,应用程序后可能会有一些空格

On MacOS with the default Bash

$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
Copyright (C) 2007 Free Software Foundation, Inc.

cd app raises the error

-bash: cd: app: No such file or directory

due to a bug of the super old Bash version installed with MacOS.

The workaround is to prefix the directory with ./ in this way

cd ./app

and it will work.

The alternative is to install a modern and better Bash version using Homebrew .

brew install bash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM