1 minute reading time (200 words)

Running (debugging) a bash script line-by-line

Mich Rodz
Run you bash script line-by-line using this technique.

The other day I was running a Bash script. It wasn't working as expected so it needed some debugging.

I needed a quick-and-dirty solution.

After some googling, I found this answer. It ended up being quite easy and handy.

All you have to do is place this line on the top of your script and Bash will prompt you after executing every line. Hitting enter key is enough to execute the next line of your script.

It is reported that this works with bash v4.2.8 and v3.2.25.

For me, it worked like a charm.

Here is the original answer in stackoverflow.

Do you have other tips for debugging Bash? I’d like to know.

Discover Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight.Watch

Make Medium yours

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox.Explore

Become a member

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month.Upgrade
Original author: Mich Rodz
Pants: The Original Conspiracy
Holmesy’s Mailbox: Why I Think The Leafs Won’t Win...