Products: BashSupport for IntelliJ® IDEA

With BashSupport you get support for Bash scripts in IntelliJ® IDEA 9.x BashSupport is OpenSource software.
Important links
Features
- Free , OpenSource
- Support for Bash 3.2 and Bash 4.0
- Configurable Syntax highlighting
- Error messages for syntax errors
- Basic refactorings
- Integrated documentation (Ctrl+O)
- ...
Download
The plugin is installed using IntelliJ® IDEA's plugin manager. The plugin's name is BashSupport. The details and older versions of the plugin are available at BashSupport on plugins.intellij.net.
Source code. BashSupport is OpenSource software and is available under the terms of the Apache license, version 2.0. Developers can download the source code: BashSupport source code.
Support
Do you have questions about the plugin? Or maybe you even have suggestions for improvements? Please send me a message using the contact form.
Usage
Execute Bash scripts

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

You can configure the settings for colors and fonts according to your needs. Please open the settings dialog using in the menu. The settings for Bash scripts are available at →→.
Here you can change the settings for the various elements of a Bash script. IntelliJ shows a preview of the settings.
Navigating in Bash scripts
Just open a Bash file. You can edit it like you are used to. For an easier navigation code folding is supported. Just fold the currently not needed functions and statement blocks away. This way you only see those parts you need to see.
If there are errors in a Bash file then it may happen that the folding of a certain section is not supported. Please correct the errors first in order to use this feature.
File structure
In the structure view IntelliJ shows the functions of the Bash script. This view is quickly availble by pressing Ctrl + F12.
BashSupport also shows nested functions.
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 in 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.
Navigating between functions
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.
Features
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.
Bash commands
If this configuration setting is enabled then the built-in Bash commands are offered in the code completion.
Script variables
Variables, which are declared in the currently edited script, are offered in the code completion.
Bash variables
If the setting is active then the built-in Bash variables like $PATH or $PWD are offered in the code completion.
Paths in the filesystem
Paths can automatically be completed. Just enter the beginning of the path. 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 beginnings:
- /
- ./
- $HOME/
- ~/
Refactoring
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 → (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 → (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 → (Ctrl+F6) to rename the marker.
Source code analysis
BashSupport offers the so-called "inspections". The source code is analysed and automatic 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.
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.
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 type into the new type.
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.
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
BashSupport supports the fomatting of Bash source code. You can press Code →Reformat Code... to reformat the current script or the currently selected text.
![]() | Caution |
|---|---|
This feature is still experimental. Thus it can be possible that your script is invalidly formatted. Also, currently there is no way to configure the formatting. |

![[Caution]](../images/caution.png)