Is there a GUI debugger for shell scripts

10,015

Solution 1

Download ShellEd eclipse plugin (update site didn't work for me) which allows editing bash scripts. Install this via Help -> Install new software -> Add -> Archive.

Download basheclipse and extract the contents to your eclipse plugins directory plugin.

Restart eclipse. Create a new Eclipse project BashTest.

Add a file myscript.sh to the project:

#! /bin/bash

. _DEBUG.sh

echo 'kshitiz'
echo 'This is a test'
x=1
y=3
z=3

Add _DEBUG.sh to your project (Its in the downloaded zip for basheclipse).

Go to Run -> Debug configurations and create a new configuration under Bash script category. Select myscript.sh.

enter image description here

Then click Debug. Open Debug perspective.

Go to Window -> Preferences -> Shell script -> Interpreters and ensure that interpreter is /bin/bash. For me the default was /bin/dash.

enter image description here

Set a breakpoint in the script. For some reason the right click menu does not show the option to set the breakpoint but Ctrl+Shift+B should work. enter image description here

Run the script Run -> Run as -> Run shell script. The breakpoint will hit but it won't be able to find your script source (wierd eh!). Just click Select Bash script and select myscript.sh.

Now you can step through the code and analyze the variables: enter image description here

Solution 2

If you are a GNU Emacs user, you can use the emacs-package realgud.

Share:
10,015

Related videos on Youtube

Benny Abramovici
Author by

Benny Abramovici

Developer who enjoys sharing knowledge. https://ksharma.dev Open source projects: Github

Updated on September 18, 2022

Comments

  • Benny Abramovici
    Benny Abramovici over 1 year

    Debugging bash scripts on command line is complicated.

    Is there a good GUI based debugger available for debugging bash scripts?

  • alfianrehanusa
    alfianrehanusa over 9 years
    Just click Select Bash script and select myscript.sh what is it mean where to select?Is it Run > Rus As or Debug > Debug As?In my case break points are not hitting.
  • OlivierLarue
    OlivierLarue over 8 years
    @Chandrayya G K : this is located in the debug perspective