Significance of "Execute in terminal" option in IntelliJ IDEA

626 Views Asked by At

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

1

There are 1 best solutions below

0
On

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.