BashSupport for IntelliJ® IDEA

BashSupport provides an almost complete development environment to work with Bash scripts in IntelliJ platform products. The plugin is the winner of the JetBrains IDEAl Plugin Contest 2009-2010. BashSupport is OpenSource software and available for free.

BashSupport editor window

Important links

Source code

BashSupport is OpenSource software and is available under the terms of the Apache license, version 2.0. The source code is available on GitHub at BashSupport source code.


Report any bug you encounter using our issue tracker.
Feature requests
If you notice a missing feature of BashSupport, please don’t hesitate to post a new request on our issue tracker.
General contact
Feel free to send me a message using the contact form.

Bash documentation

Bash hackers wiki
Bash hackers wiki offers a lot of great information on Bash
GNU Bash reference
The official Bash reference manual


The plugin is installed using IntelliJ® IDEA’s plugin manager, JetBrains offers detailed information how to do this. The plugin’s name is BashSupport. Detailed information and a list of all available versions of the plugin is available at BashSupport on


  • BashSupport is free and OpenSource software, licensed under the terms of the Apache 2.0 license
  • Support for Bash 3.2 and Bash 4.0
  • Configurable syntax highlighting
  • Error messages for syntax errors
  • Basic refactorings, inspections and quickfixes
  • Integrated documentation


Execute Bash scripts

BashSupport run configuration editor

Bash run configuration

BashSupports can directly run scripts within IntelliJ. You can create a new run configuration for Bash scripts. Here you can set which interpreter is used to run it.

Whenever a script is executed the output is logged. If Bash prints out syntax errors then the errorneous lines are clickable to jump to the location of the error.

Project settings

The project settings are set in the project settings area of the settings dialog.

Language level

The plugin supports the new features and changes which were introduced with Bash version 4.0. If this setting is chosen then all scripts are read as Bash 4.0.

Global variables

A set of global variables can be configured for each project. Unknown variables with these names are not flagged as an arror any more. If desired the variable names can be offered in the code completion, as well.

Global settings

File extensions

By default BashSupport supports these file extensions:

  • .sh
  • .bash

IntelliJ offers the possibility to link so far unknown file extensions to a plugin. Just choose BashSupport to open files with this newly registered file extension as bash files.

Often Bash scripts are saved without a file extension. BashSupport can be configured so that it accepts files without extensions as Bash scripts. If you enable this options then all files will be linked to BashSupport. But if you want to only link those files to BashSupport which really are Bash scripts then you can enable the other option. Then BashSupport will look at the file content to guess the file type.

Colors and fonts

Color and font settings

Color and font settings

You can configure the settings for colors and fonts according to your needs. Please open the settings dialog using Settings in the File menu. The settings for Bash scripts are available at Editor → Colors & Fonts → Bash.

Here you can change the settings for the various elements of a Bash script. IntelliJ shows a preview of the settings.

Just open a Bash file. You can edit it like you are used to.

File structure

In the structure view IntelliJ shows the functions of the Bash script. This view is quickly availble by pressing Ctrl + F12.

Nested functions are also displayed.

Go To → Declaration Ctrl + B

BashSupport supports Go to → Declaration. If you position the caret on a function call and run this action then the caret will jump to the location of the declared function.

This feature is also available on heredoc markers.

View → Quick Definition Lookup Ctrl + Shift + I

BashSupport shows the source code of the declared function if you apply this action to a function call.

Search → Highlight Usages in File Ctrl + Shift + F7

If you position the caret on a function call or on the name of a function and run this action then IntelliJ will highlight all locations where this function is used. Jump to the next position by pressing F3 .

This feature is also available in heredoc markers.

In the editor you can navigate between functions of a file by using Alt+Up and Alt+Down .

Brace matching

If you position the caret before or after a bracket then IntelliJ will highlight the other element of the pair of brackets.

Code completion

BashSupport supports the automatic code completion. The suggestions are displayed be pressing Ctrl + Space.


The code completion offers the defined functions of the currently edited script. A function is only offers if it was declared before the current file location.

Completion of function names
function showHome() {
    ls -ls $HOME

sho|#<- caret is here, shows 'showHome'

Bash commands

If this configuration setting is enabled then the built-in Bash commands are offered in the code completion.

Code completion of Bash commands
ec|#<- caret is here, shows "echo"

Script variables

Variables, which are declared in the currently edited script, are offered in the code completion.

Code completion of variables
echo $MY|#<- caret is here, shows 'MY_HOME'

Built-in Bash variables

If the setting is active then the built-in Bash variables like $PATH or $PWD are offered in the code completion.

Code completion of built-in variables
ls -la $HO|#<- caret is here, shows 'HOME'

Paths in the filesystem

Paths can automatically be completed. Just enter the beginning of the path and then press Ctrl+Space. IntelliJ now offers a set of directories and file paths of you system which match your input.

BashSupport recognizes paths with these prefixes:

  • /
  • ./
  • $HOME/
  • ~/
Code completion of filenames
ls -la $HOME/.bash| # <- caret is here, shows '.bashrc', for example


BashSupport supports simple refactorings in Bash scripts

Renaming of functions

Functions can be renamed. For this the definition itself and all calls of it are changed. Position the caret on the name ofa definition or on a call to a function. Use Refactor → Rename… (Ctrl+F6) to change the name.

Renaming of variables

Variables can be renamed in the same way as functions. Position the caret on the identifier in an assignment or on the use of a variable. Call Refactor → Rename… (Ctrl+F6) to rename the variable.

Renaming of heredoc markers

The start- and endmarkers of heredocs can be renamed. Place the caret on the marker and choose Refactor → Rename… (Ctrl+F6) to rename the marker.

Source code analysis

BashSupport offers the so-called “inspections”. The source code is analysed and fixes are offered for the found problems.

Shebang: Adjustments

If the first line starts with #! it’s called the shebang line. It defines the command which is used to execute the script. If this command is an usual command line a quickfix is shown.

If the command is valid alternatives are offered. For example, /bin/bash is suggested if /bin/sh is used.

Unusual shebang line changed to a known command
# Before the quickfix
echo Hello World
# After the quickfix
echo Hello World

Functions: Wrap body in braces

In Bash it is possible to define a function’s body without sourrounding braces. In these cases BashSupport offers a quickfix to automatically wrap the body in braces.

Function body without braces
# Before the quickfix
function helloWorld
    if echo Hello; then echo " World"; fi
# After the quickfix
function helloWorld {
    if echo Hello; then echo " World"; fi

Conversion of backtick to subshell-commands

In Bash there are two possibilities to run commands in a subshell. The old way is `echo a` , the new way is $(echo a). With this inspection you can convert an expression from the old to the new type.

Call with backticks
# Before the quickfix
echo `echo hi there`
# Subshell call after the quickfix has been applied
echo $(echo hi there)

Conversion of subshell to backtick commands

This inspections is used to convert subshell calls like $(...) to the old way using backticks.

This inspection is deactivated by default. If you want to use it you have to manually enable it.

Duplicate function definition

This inspection marks a function definition which overwrites a previously defined function.

Evaluate expansions

Using this inspection Bash expansions like {a..z}{0..9} can be converted to the evaluated result. All kinds of expansions are supported. If the support for Bash 4.0 has been enabled then the expanded expansions are supported, as well.

Printing the numbers between 1 and 10
# Before the quickfix
echo {1..10}
# After the quickfix
echo 1 2 3 4 5 6 7 8 9 10

Missing include file

If the filename of an include command is static, i.e. it does not contain any variable, then this inspection checks if the given file is available on the current system. If the file is missing then the command will be marked with a warning.

Recursive include commands

If a file includes itself with an include command then this will loop indefinitely. This inspection spots if a script includes itself and marks those commands with an error.

Source code formatting

This feature is still experimental.
It’s possible that your script is incorrectly formatted. Also, currently there is no way to configure the formatting. You have to activate this feature by enabling Settings… → Languages & Frameworks → BashSupport → Enable formatter.
You have to activate this feature by enabling Settings… → Languages & Frameworks → BashSupport → Enable formatter.

BashSupport supports the fomatting of Bash source code. You can press Code → Reformat Code… to reformat the current script or the currently selected text.

Language injection

BashSupport supports language injection into strings and heredoc elements.

Further information

Setting the injected language

You can either temporarily inject a language using IntelliJ’s default action. In this case the injected language will be lost once you delete the element or close the file.

To keep the injected language persistently, you can use a comment #language=LANGUAGE.

JSON injected into a Bash string
export JSON="
  {\"message\": \"Bash is great :)\"}
JSON injected into a heredoc
cat <<EOF
     "id": "abc",
     "message": "Bash is great :)"