-bash: 打开: 命令未找到

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27110648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 11:52:12  来源:igfitidea点击:

-bash: open: command not found

macosbashcordovacommand-line.bash-profile

提问by nlw13

I was working on amending my ANDROID_HOMEand PATHto begin working with Cordova for mobile application development. I was having trouble with export $PATHreturning a not a valid identifiererror. I changed a $PATHreference in a line in the .bash_profileto PATHon recommendation and now I'm entirely unable to open .bash_profile. I am using Mac OS X Yosemite. I receive the following error:

我正在修改我的ANDROID_HOMEPATH开始使用 Cordova 进行移动应用程序开发。我在export $PATH返回not a valid identifier错误时遇到了麻烦。我改变了$PATH在一个基准线.bash_profilePATH上建议,现在我完全无法open .bash_profile。我正在使用 Mac OS X 优胜美地。我收到以下错误:

-bash: open: command not found

-bash: open: command not found

From research, it's likely a typo in the .bash_profilebut I'm unaware of how I can rectify this without being able to open the .bash_profile itself, can anybody help? Also when attempting to call Cordova e.g. cordova add platform androidI receive -bash: cordova: command not foundafter it previously functioned correctly?

从研究来看,这可能是一个错字,.bash_profile但我不知道如何在无法打开 .bash_profile 本身的情况下纠正这个问题,有人可以帮忙吗?此外,当cordova add platform android我尝试调用 Cordova 时,例如我-bash: cordova: command not found在它之前正常运行后收到?

My .bash_profileincluded export ANDROID_HOME=/Development/android-sdk-macosx export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

我的.bash_profile包括 export ANDROID_HOME=/Development/android-sdk-macosx export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

I believe I mistakenly removed $ from the 2nd line, leaving PATH={PATH}.

我相信我错误地从第二行中删除了 $,离开 PATH={PATH}.

As I am using Mac OS X all dot files are hidden, when attempting to show . files I receive the error -bash: defaults: command not found.

由于我使用的是 Mac OS X,因此在尝试显示 . 文件我收到错误-bash: defaults: command not found

Thanks

谢谢

回答by l0b0

export $PATHdoesn't do what you expect - variable substitution happens beforecommand execution in Bash. You need to export PATH. And to debug the contents of any dot files you need to include their contents in the question.

export $PATH不符合您的预期 - 变量替换发生在 Bash 中的命令执行之前。你需要export PATH。并且要调试任何点文件的内容,您需要在问题中包含它们的内容。

回答by Etan Reisner

Having destroyed your PATHenvironment variable your shell can no longer find any binaries. You can either give a full path to whatever application you want to run to edit your .bash_profilefile or just open it from your chosen editor using the gui file selector.

破坏了您的PATH环境变量后,您的 shell 无法再找到任何二进制文件。您可以提供要运行以编辑.bash_profile文件的任何应用程序的完整路径,也可以使用 gui 文件选择器从您选择的编辑器中打开它。