简体   繁体   English

在Mac OS X Terminal中使用命令打开新程序

[英]Opening New Programs using Commands in Mac OS X Terminal

I want to open programs in Terminal by writing a single command, like what is already done for Java complilation: 我想通过编写单个命令在Terminal中打开程序,就像已经为Java编译所做的那样:

javac HelloWorld.java

For any program I install, that functionality isn't available. 对于我安装的任何程序,该功能都不可用。 For example, to open SWI-Prolog I have to type 例如,要打开SWI-Prolog,我必须输入

/opt/local/bin/swipl

when I want to type just 当我想打字时

swipl

which results in a -bash: swipl: command not found . 结果为-bash: swipl: command not found How do I create this new command? 如何创建此新命令?

Adjust the BASH PATH environment variable. 调整BASH PATH环境变量。 Edit your .bash_login or .bash_profile in your home directory, add at the end of the file the follwing lines: 在主目录中编辑.bash_login.bash_profile ,在文件末尾添加以下行:

 PATH=$PATH:/opt/local/bin
 export PATH

Source your file or simply close the current terminal and open a new one. 源文件或仅关闭当前终端并打开一个新终端。

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

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