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

  1. Create an empty run configuration of type BashSupport Pro, e.g. via Run → Edit 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 completion and many other features are available in this context.
  3. In our example the snippet is
    1
    2
    
    echo "Opening $1"
    nohup xdg-open "$1" >/dev/null 2>&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.
© 2020–2024 Joachim Ansorg
Правовая информация
Политика конфиденциальности
Юридическая информация