如何在 IntelliJ 中设置 bash 解释器路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35628012/
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
How to set bash interpreter path in IntelliJ
提问by PavelPe
I am wondering which path should be set in "Interpreter path" area in Run/Debug Configurations in IntelliJ, to complie and run bash script.
我想知道应该在 IntelliJ 中运行/调试配置的“解释器路径”区域中设置哪个路径,以编译和运行 bash 脚本。
Using IntelliJ 15.0.3 on Windows 7
在 Windows 7 上使用 IntelliJ 15.0.3
回答by noEmbryo
You must have a shell installed.
你必须安装一个shell。
I have Gitinstalled, so I use the path to the git shell.
我已经安装了Git,所以我使用了 git shell 的路径。
Something like C:\Program Files\Git\bin\sh.exe
.
类似的东西C:\Program Files\Git\bin\sh.exe
。
I use also the --login -i
flags for the "Interpreter options" field.
我还使用--login -i
“解释器选项”字段的标志。
回答by Peter
If you want to use the Windows CMD.exe you have to set:
如果你想使用 Windows CMD.exe 你必须设置:
- Interpreter path:
C:\WINDOWS\system32\CMD.exe
(or wherever your cmd.exe is located) - Interpreter options:
/K
- Working directory:
path/to/your/project
- 解释器路径:(
C:\WINDOWS\system32\CMD.exe
或 cmd.exe 所在的任何位置) - 口译选项:
/K
- 工作目录:
path/to/your/project
in the IntelliJ run config.
在 IntelliJ 运行配置中。
(Tested with IntelliJ 2017.3)
(使用 IntelliJ 2017.3 测试)
回答by Prabah
In Ubuntu,
Interrupter path can be set to: /bin/bash
在 Ubuntu 中,
Interrupter 路径可以设置为:/bin/bash
回答by Mikhail Gerasimov
On Windows 10 you can also use PowerShell.
在 Windows 10 上,您还可以使用 PowerShell。
- Interpreter path:
c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe
- Interpreter options:
-Command
- Working directory: path/to/your/project
- 口译路径:
c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe
- 口译选项:
-Command
- 工作目录:path/to/your/project
回答by Cesar Chavez
For gitbash as your interpreter i found 2 ways
对于 gitbash 作为你的解释器,我发现了 2 种方法
1.- For "BashSupport" plugin in intellij
1.- 对于 intellij 中的“BashSupport”插件
Type Ctrl + Alt + S to go to settings Search for Bash Support or go to "Languages & Frameworks->BashSupport" In "Default Interpreter" put the path for gitbash C:\Program Files\Git\bin\bash.exe
Then right click on the script to run and click on Edit script Then click in "Use project interpreter" Then in "Interpreter options" put --login -i --
键入 Ctrl + Alt + S 转到设置搜索 Bash 支持或转到“语言和框架-> BashSupport”在“默认解释器”中输入 gitbash C:\Program Files\Git\bin\bash.exe 的路径
然后右键单击要运行的脚本并单击编辑脚本然后单击“使用项目解释器”然后在“解释器选项”中输入 --login -i --
2.- For "Shell Script" plugin in Intellij
2.- 对于 Intellij 中的“Shell Script”插件
First set gitbash as your terminal Ctrl + Alt + S to go to settings Search for Terminal or go to "Tools->Terminal" In "Shell path" put C:\Program Files\Git\bin\bash.exe
Then Right click on the script to run and click on Edit script Then in "Interpreter path" put C:\Program Files\Git\bin\bash.exe Then in "Interpreter options" put -login -i --
首先将 gitbash 设置为您的终端 Ctrl + Alt + S 转到设置搜索终端或转到“工具->终端”在“外壳路径”中输入 C:\Program Files\Git\bin\bash.exe
然后右键单击要运行的脚本并单击编辑脚本然后在“解释器路径”中输入 C:\Program Files\Git\bin\bash.exe 然后在“解释器选项”中输入 -login -i --