Languages and frameworks: Shell scripts
This functionality relies on the Shell scripts plugin, which is bundled and enabled in JetBrains Rider by default. If the relevant features are not available, make sure that you did not disable the plugin.
Press CtrlAlt0S to open settings and then select Plugins.
Open the Installed tab, find the Shell scripts plugin, and select the checkbox next to the plugin name.
JetBrains Rider provides coding assistance for shell script files: completion (including local paths), highlighting, quick documentation textual rename refactoring, and more.
![https://resources.jetbrains.com/help/img/rider/2024.3/cl_shellscript_assistance.png](https://resources.jetbrains.com/help/img/rider/2024.3/cl_shellscript_assistance.png)
It also includes a special type of run/debug configurations for shell scripts.
JetBrains Rider integrates with several external tools to enhance shell script support:
ShellCheck is a shell script static analysis tool that can detect syntax errors, semantic problems, corner cases, and typical pitfalls. JetBrains Rider will prompt you to install it if it is not available.
Shfmt is an external formatter engine for shell scripts. JetBrains Rider will suggest installing it when you reformat code CtrlAltEnter of the shell script for the first time.
Explainshell is a website that can parse any shell command and provide help text for each argument. Access to it is available via an context action: press AltEnter and select Explain shell.
By default, JetBrains Rider recognizes files with the following extensions as shell scripts: .sh, .bash, .zsh. However, you can configure JetBrains Rider to recognize any file types as shell script files (for example, if you want to edit .csh files).
In the Settings/Preferences dialog (CtrlAlt0S) , select Editor | File Types.
In the Recognized File Types list, select Shell Script and add the necessary patterns in the File Name Patterns list below.
Click OK to apply changes.
When working on a shell script file, click
in the gutter. This will run your script in the built-in Terminal.
If you want to customize the startup of your script (for example, specify the script and interpreter options), you can also create a Shell Script run/debug configuration.
note
If you run a script from the gutter icon and do not specify the shebang in your script, JetBrains Rider will use your default system interpreter defined by the
SHELL
environment variable. If you create a Shell Script run/debug configuration for a script file, JetBrains Rider will use the interpreter specified in the Interpreter path field of that configuration.
In the main menu, go to Run | Edit Configurations.
Click
and select Shell Script.
Under Execute, select the Script file option.
Specify the path to the script file and options that you want to pass to the script when it is launched. You can also change the interpreter for running the script and additional options for the interpreter.
Click OK to save the run/debug configuration.
You can create a Shell Script run/debug configuration for simple arbitrary commands without creating a script file. This can be useful, for example, if you want to automatically run this command before another configuration is launched and do not want to create a separate file for it.
In the main menu, go to Run | Edit Configurations.
Click
and select Shell Script.
Under Execute, select the Script text option.
Enter the command text and, optionally, change the command working directory.
Click OK to save the run/debug configuration.
![Shell Script run/debug configuration Shell Script run/debug configuration](https://resources.jetbrains.com/help/img/rider/2024.3/shell_script_configuration_for_command.png)
If you want to run this command before another configuration (for example, another script) is launched, you can select the created configuration in the Before launch area of another configuration.