Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Debugging bash scripts on command line is complicated.

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

share|improve this question

2 Answers 2

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

share|improve this answer
up vote 4 down vote accepted

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

share|improve this answer
    
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. –  Chandrayya G K Oct 22 '14 at 15:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.