简体   繁体   English

-bash:cd:app:没有这样的文件或目录

[英]-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. 我只是在finder中更改了名称,现在在终端中使用命令时,这就是我不断收到的错误。 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. 该路径显然是正确的,因为当我尝试cd进入目录时,我已经在它所在的目录中。

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的MacOS

$ 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 cd app引发错误

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

due to a bug of the super old Bash version installed with MacOS. 由于MacOS所安装的超旧Bash版本存在错误。

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 . 替代方法是使用Homebrew安装现代更好的Bash版本。

brew install bash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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