Quickstart With BashSupport Pro

Thank you for using BashSupport Pro!

We hope that this tutorial helps you to get started quickly. Please contact support if you’re stuck or if you don’t know how to use our software.

Installing a JetBrains IDE

Skip this step

BashSupport Pro is an extension for JetBrains IDEs. You have to install such an IDE to use our software. If you’re already using IntelliJ IDEA or any of the other IDEs, then just skip this step.

  1. Pick an IDE. The easiest way is to select one using the JetBrains product chooser.
  2. Click the “Download” button next to the IDE of your choice.
    Using the JetBrains product chooser

    Using the JetBrains product chooser

  3. Install the IDE on your system. For our tutorial, we’ll use IntelliJ IDEA Community. An alternative way to install it is JetBrains Toolbox. The download page has links to install instructions.
  4. Launch it. It will now display a wizard to set up your IDE.
    IntelliJ IDEA's welcome screen
    IntelliJ IDEA's welcome screen
  5. Click Open and choose an empty directory as a project. In our example, we’ll pick /bashsupport-project as directory path.
    Choosing an empty project directory
    Choosing an empty project directory
  6. Now, a new window of your IDE will be opened.
    IntelliJ IDEA with a new project
    IntelliJ IDEA with a new project
  7. Close the dialog about daily tips and other the visible notifications. If your IDE opened a new file for the new project, just close it.

Installing and Configuring BashSupport Pro

Skip this step

You need:

  • a JetBrains IDE, version 2022.1 or later
  • macOS, Linux or Windows

There are two ways to install the BashSupport Pro Plugin.

Automatic Installation

Skip this step

  1. Launch your JetBrains IDE
  2. Click the “Install” button below. Your IDE will prompt you to trust “bashsupport.com”. When you accept a dialog will appear where you confirm to install our plugin.
  3. Please restart your IDE to activate the new plugin.
Installieren

Manual Installation

Skip this step

  1. Choose Preferences… → Plugins → Marketplace.
  2. Enter “bashsupport pro” into the search input.
  3. Click Install next to the “BashSupport Pro”.
  4. Your IDE may show a message to trust 3rd-party plugins. You need to confirm to continue.
  5. The Install button changes to Restart IDE
  6. Click the Restart button to complete the installation of BashSupport Pro.
How to manually install BashSupport Pro in IntelliJ IDEA
How to manually install BashSupport Pro in IntelliJ IDEA

Activating Your License

Skip this step

BashSupport Pro needs a license. There’s a free 30-day trial license if you’re using it for the first time.

  1. After the restart, your IDE displays a dialog to enter the license information.
    Dialog to register your license of BashSupport Pro
    Dialog to register your license of BashSupport Pro
  2. Choose the license you’d like to activate:
    • Activate BashSupport Pro if you’ve already purchased a license
    • Start trial to use your free 30-day trial. This is only possible if you’ve not used a trial of the current major version before.
  3. Click Log In to JetBrains Account… to fetch the license associated with your JetBrains account.
  4. Click Activate to finish the activation and to close the dialog.

Congratulations, you’ve successfully registered your copy of BashSupport Pro!

Setting Up BashSupport Pro

Skip this step

  1. Now, you should see the main window and a notification to help you set up BashSupport Pro.

    Notification to configure BashSupport Pro
    Notification to configure BashSupport Pro

  2. Click Open Setup to launch the setup wizard. If you don’t see this notification, please use Help → BashSupport Pro Setup.

  3. The first page lists important links and how to get started. Click Next.

    Setup wizard of BashSupport Pro
    Setup wizard of BashSupport Pro

  4. Configure the plugins of your IDE.

    Most JetBrains IDEs bundle the JetBrains Shell plugin. Because the Shell plugin registers itself for the same file extensions it’s not recommended using both plugins at the time.

    Click Next to disable the JetBrains Shell plugin.

    Setup wizard of BashSupport Pro
    Setup wizard of BashSupport Pro

  5. Now you can take a few optional steps. If you’d like to receive occasional updates about the plugin please register for the newsletter.

    Click Next to apply the information.

    Optional setup step of BashSupport Pro
    Optional setup step of BashSupport Pro
  6. If necessary, the final step asks you to restart your IDE. Please Restart to apply all changes. Otherwise, click Finish to close the dialog.

    Final setup step of BashSupport Pro
    Final setup step of BashSupport Pro

Configuring Your Shell Interpreters

Skip this step

BashSupport Pro detects the installed shell script interpreters on your system. Please make sure that you’ve installed at least one supported Bash interpreter and that it’s properly detected.

  1. Open the settings at Preferences… → Languages & Frameworks → BashSupport Pro → Shell Interpreters
    Interpreter settings
    Interpreter settings
  2. Verify that there’s at least one row with type Bash (.bash) in the table.
  3. If you don’t see at least one Bash interpreter, please make sure it’s installed and refresh the table with the “Rescan” action.
  4. Close this dialog.

Creating Your First Script

Skip this step

Now, we’re ready to create our first shell script file!

  1. Open the project view, that’s the tool window on the left with title Project.
  2. Select the top-level directory and open the context menu by right-clicking on the item
  3. Choose New → Shell Script
    How to create your first shell script file
    How to create your first shell script file
  4. A popup to create the shell script file appears.
    Popup to chooser the type of your new script
    Popup to chooser the type of your new script
  5. Enter quickstart.bash as filename and press Enter to create the new file.
  6. Now, the file is created and the editor for it is opened. You’ll see a popup to let you choose the shebang line. Just press Enter to accept the default value.
    Editor showing the new file
    Editor showing the new file

Editing Your Script

Skip this step

Our task is to create a function, which takes a number and prints the sum 1 + 2 + ... + n to STDOUT. For example, for n=5 the sum of 1+2+3+4+5 is 15.

  1. Type func get the live template for a new function. If necessary, press altenter to see the code completion menu.
    Live template to create a new function
    Live template to create a new function
  2. Type the name of the new function: print_sum .
    Press Enter to move the text cursor inside the function.
  3. Press Enter once more to confirm the suggested body of the function.
    Newly created shell script function
    Newly created shell script function
  4. Now, we’re ready to implement this function!
    We’re lazy and use the formula for triangular numbers:
    sum = n * (n + 1) / 2. We’re using an arithmetic expression $(( )) to calculate the result.
  5. Our function now looks like this:
    Function to print the sum of 1+2+...+n
    Function to print the sum of 1+2+...+n

Code Completion

Skip this step

Our function is still unused. We’ll use code completion to insert a call of it.

  1. Add a few empty lines at the end of the file.
  2. Invoke code completion with CtrlSpace to show the name of our new function.
    Autocompletion of a function name
    Autocompletion of a function name

Renaming Elements

Skip this step

BashSupport Pro helps you to rename variables, functions, and more.

Renaming a Function

Skip this step

Let’s rename the function print_sum to triangular_number. To do this, place the text cursor on print_sum. It doesn’t matter if it’s the name of the definition or the name in the invocation.

Choose Refactor → Rename… to start the rename refactoring.

Renaming a shell script function
Renaming a shell script function

Enter the new name and confirm your choice with Enter .

Updated name of a shell script function
Updated name of a shell script function

Renaming a Variable

Skip this step

Variables are renamed in the same way. Let’s rename the local variable n to number.

Place the text cursor on n, invoke Refactor → Rename… and enter the new name of the variable.

Renaming a shell script variable
Renaming a shell script variable

As you can see, the definition and all references have been updated.

Formatting

Skip this step

The spacing and indentation of our file needs a cleanup. Let’s reformat it!

Invoke Code → Reformat File to choose how to reformat it. Choose Whole file, because that’s supported best.

Reformatting a Bash file
Reformatting a Bash file

Confirm your choice with Enter to reformat the file. It now looks like this:

Result after reformatting the Bash file
Result after reformatting the Bash file

Skip this step

Go To Definition

Skip this step

Navigate → Declaration or Usages allows you to navigate between references to functions or variables and their definitions. Let’s practice this with the variable number.

  1. Place the text cursor on a reference to variable number.
    Navigating from variable reference to definition
    Navigating from variable reference to definition
  2. Execute Navigate → Declaration or Usages or use the matching keyboard shortcut.
  3. The text cursor is now at the position, where the variable is defined.
    After navigating to a variable definition
    After navigating to a variable definition

Executing Your Script

Skip this step

It’s time to execute our little script!

There are two ways to do this:

  1. Run → Run ‘quickstart.bash’
    Executing a script using the main menu
    Executing a script using the main menu
  2. The green arrow on the left of the first line of the editor.
    Executing a script using a line marker
    Executing a script using a line marker

Execute the script by clicking any of the two items. Tool window Run is now opened and displays the output of the script.

Output after executing the script
Output after executing the script

Debugging Your Script

Skip this step

Setting Breakpoints

Skip this step

A breakpoint defines where the execution should pause to let you debug it. You can add a breakpoint by clicking into the empty space left of a line. A red dot signals that a breakpoint is set on a line.

Adding a breakpoint to the shell script
Adding a breakpoint to the shell script

Launching The Debugger

The debugger is launched in almost the same way, just use Debug ‘quickstart’ instead.

Launching the debugger using a line marker
Launching the debugger using a line marker

When you launch the debugger, the Debug tool window is shown.

Shell script debugger stopped at a breakpoint
Shell script debugger stopped at a breakpoint

In the tool window, you see the available variables, their current values, and more. Please refer to our documentation about the debugger to learn more about it.

Congratulations!

Thanks for following up to the end!

There’s a lot more of what BashSupport Pro can do:

Contact us if you have questions or other feedback about BashSupport Pro.

© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches