How to Execute a Shell Script Snippet
A powerful feature of BashSupport Pro’s run configuration is the support for inline snippets. You can define a small shell script in the run configuration without having to store it in the file system.
How to Define a Snippet
- Create an empty run configuration of type BashSupport Pro, e.g. via Run → Edit Configurations… → BashSupport Pro
- Choose Inline Snippet as the source of the run configuration
- Enter the snippet in the editor below
Example: Choose and Open a File
The screenshot above displays a run configuration to quickly open a file with your operating system’s default handler. This example won’t work on Windows, though.
- Choose Snippet as the run configuration’s source.
- Define the snippet in the editor below. Code completion and many other features are available in this context.
- In our example the snippet is
echo "Opening $1" nohup xdg-open "$1" >/dev/null 2>&1
- Insert the macro
$FilePrompt$into the script argument field.
The plus-sign on the right allows you to browse all available macros. The IDE evaluates macros before the run configuration is executed. So it’ll first prompt you to select a file and then passes the chosen path to the script as an argument.