IDE for Bash-/Shell-Scripting

Shell-Scripts have become a daily companion of mine over the last ten years. However, I used to develop those scripts just with a simple text editor and then tested the execution simply from the terminal. Having come to enjoy the perks of an IDE (during my excessive work with RStudio), the process of shell scripting felt cumbersome.

IDE: Visual Studio Code

I researched, tested, and compared different solutions to act as convenient code editors / IDE for shell scripting. Finally, I decided for Visual Studio Code (open source, maintained by Microsoft). VS Code is a universal multi-language IDE with tons of additional helpful features integrated and endless extendability through add-ons. At first, VS Code is a bit overwhelming. However, the patience of getting familiar with it pays off. (There is a discussion on whether to call VS Code an IDE or a text editor. IDEs are defined by the capability to compile/run/debug code. VS Code itself is not capable of the latter, but with add-ons installed, it actually is.)

Debugger: bashdb (within VS Code)

Using a GUI-based debugger for bash makes development much easier and much more convenient. The VS code add-on “bashdb” offers that debugger capability. Most importantly, now I can step through my scripts using breakpoints and supervise variables’ values. (At the moment, one of the add-on’s limitations is that it does not recognise all declared variables automatically, but variables of interest need manually be added to the watch section. However, this feature is on the developer’s to-do list for v0.4.0 or later. Alternatively, one can simply hover over the variable’s name in the code to see its current value.)

VS Code with bashdb add-on, showing breakpoints and variable watch.

The configuration of the debugger within VS code happens in the launch.json file, which is created separately for each workspace under .vscode/launch.json. There are three options I regularly use:

  • “terminalKind” sets where the script for debugging is executed (“integrated”, “external”, “debugConsole”).
  • “args” are the run arguments, like the arguments when calling a script from the shell ($1, $2, …).
  • “env” sets environmental variables.
    "version": "0.2.0",
    "configurations": [
            "type": "bashdb",
            "request": "launch",
            "name": "Bash-Debug (simplest configuration)",
            "program": "${file}",
            "terminalKind": "integrated", 
            "args": ["firstArg", "secondArg"],
            "env": {
                "MYVAR":"aaa bbb ccc", 
                "MYVAR2": "bbb"

More: Code-completion, Git

As code-completion / language server add-on I use “Bash IDE“. Moreover, I heavily utilise the integrated Git capabilities of VS code. (After several years in development, learning and using Git (once again) changed my life.)

Over the last ten years, I never invested that bit of time to figure out an ideal development environment. I am glad that now I did! That time actually pays off every day: Having this environment dramatically speeds up my development process for bash scripts. And, most importantly, it makes the full process more enjoyable.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.