这是因为该\字符在 Bash shell 中被视为“转义符”。
执行以下命令:
sudo apt-get install some-package some-other-package yet-another-package oh-my-we-have-a-lot-of-packages and-still-another-package wow-so-many-packages
Run Code Online (Sandbox Code Playgroud)
我们可以改写这个命令,如下所示:
sudo apt-get install some-package some-other-package \
yet-another-package oh-my-we-have-a-lot-of-packages \
and-still-another-package wow-so-many-packages
Run Code Online (Sandbox Code Playgroud)
Bash 会将 解释\为“阅读下一行作为这一行的一部分”。在您的情况下,您键入cd \,因此 Bash 希望您再给它一行。
如果你想快速返回到你的主目录(即~),您可以使用cd ~ 或只是简单cd。