2

I am trying to create a shell script run configuration with existing system utilities. Here's a test Run Configuration for printing the present working directory.

Run Configuration for Shell Script

Output for this Run Configuration :

Output1

When I uncheck the Execute in terminal option in the Run Configuration, I get this output :

Output2

What is the significance of this option and is it possible to make it work with the Execute in terminal option unchecked?

IDE version : IntelliJ IDEA 2020.3 (Community Edition), Build #IC 203.5981.155

OS : Ubuntu 20.04.1 LTS

Saurabh P Bhandari
  • 6,014
  • 1
  • 19
  • 50
  • Could you please explain your options in the configuration? Why are you trying to cheat with the ` added to different fields? Basically, write a Java app that will use Runtime.exec to run your command. With the Terminal option enabled this command is evaluated by the real terminal in the real shell. Otherwise it's just exec of the terminal shell command with the arguments. – CrazyCoder Dec 09 '20 at 07:06
  • @CrazyCoder Thank you for your reply, This is just a test configuration, what I was actually trying to achieve is a quick way to do Liniting on a JenkinsFile in Intellij IDEA. Refer to this [Linting via HTTP POST using curl](https://www.jenkins.io/doc/book/pipeline/development/). I believe there is no such plugin available for Intellij IDEA, so thought of using Run configuration/External Tool. However, faced this above issue when I was trying to use user defined variables like *JENKINS_URL* etc. Also without the hack, I wasn't able run the curl command, possibly you can suggest a better way. – Saurabh P Bhandari Dec 09 '20 at 12:34
  • Create `.sh` file with the commands you need to run and start it from the external tool via `bash`. – CrazyCoder Dec 09 '20 at 18:23

1 Answers1

0

IntelliJ comes bundled with a terminal plugin simply called "Terminal".

When you have the plugin enabled, and the checkbox "Execute in the terminal" checked, the run config will be run inside the "Terminal" window, within your usual interactive shell.

With the checkbox unchecked, it runs in the "Run" window instead.

When you have the plugin disabled, the checkbox makes no difference.

Also note that in newer versions of IntelliJ (I'm on 2022.2.3 currently), there is a new option to run "Script text" instead of a script file. With that option, you don't have to fiddle around with bash -c for running a single command. For your example, just Script text: echo "$PWD" works.

Dario Seidl
  • 4,140
  • 1
  • 39
  • 55