How to set bash interpreter path in IntelliJ
Asked Answered
K

6

11

I am wondering which path should be set in "Interpreter path" area in Run/Debug Configurations in IntelliJ, to complie and run bash script.

Using IntelliJ 15.0.3 on Windows 7

Kerseymere answered 25/2, 2016 at 12:58 Comment(0)
F
19

You must have a shell installed.

I have Git installed, so I use the path to the git shell.

Something like C:\Program Files\Git\bin\sh.exe.

I use also the --login -i flags for the "Interpreter options" field.

Flypaper answered 26/2, 2016 at 12:24 Comment(0)
F
11

If you want to use the Windows CMD.exe you have to set:

  • Interpreter path: C:\WINDOWS\system32\CMD.exe (or wherever your cmd.exe is located)
  • Interpreter options: /C
  • Working directory: path/to/your/project

in the IntelliJ run config.

(Tested with IntelliJ 2017.3)

Fearful answered 12/12, 2017 at 11:58 Comment(3)
What does the /K means? I dont found any info about the Interpreter optionsMisogynist
/K is a switch for Run Command and then return to the CMD prompt. (source: ss64.com/nt/cmd.html). I don't know why exactly it's needed but it didn't work for me without it.Fearful
/K option will keep IDEA configuration running even after script is done. It's better to use /C instead: it will run script and finish properly.Deirdre
M
3

In Ubuntu,
Interrupter path can be set to: /bin/bash

Mccarthy answered 9/6, 2019 at 12:32 Comment(0)
H
2

For gitbash as your interpreter i found 2 ways

1.- For "BashSupport" plugin in intellij

  • 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 --

2.- For "Shell Script" plugin in Intellij

  • 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 --

Hartzel answered 22/12, 2019 at 6:54 Comment(0)
D
1

On Windows 10 you can also use PowerShell.

  • Interpreter path: c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe
  • Interpreter options: -Command
  • Working directory: path/to/your/project
Deirdre answered 11/11, 2018 at 19:35 Comment(0)
F
0

catch

For example, in Windows I specified the path to the powershell executable file. You can probably indicate your cmd.

Fruitless answered 26/5 at 7:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.