How to Execute a Shell Script Snippet

A powerful feature of BashSupport Pro’s run configuration is the support for inline snippet. You can define a small shell script in the run configuration without having to store it somewhere in the file system.

To define a snippet:

  1. Create an empty run configuration of type BashSupport Pro, e.g. via RunEdit Configurations…BashSupport Pro
  2. Choose Inline Snippet as the source of the run configuration
  3. 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.

  1. Choose Snippet as the run configuration’s source.
  2. Define the snippet in the editor below. Code completions and many other features are available in this context.
  3. In our example the snippet is
    1
    2
    
    echo "Opening $1"
    xdg-open "$1"  
    
  4. 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.