Skip to content

kjkuan/tbd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

25 Commits

Repository files navigation

What is it?

TBD(Tmux Bash Debugger) is a simple debugger for Bash that can be used to interactively inspect or debug the execution of a Bash script. It's meant to be source'ed into your script at the place where you want a break point to be set. Once at the break point,TBDwill take over and run in a separatetmuxwindow, from which you can interact and explore the execution environment of the script.

NOTE:TBDtemporarilyset +eufor the duration of a debugging session.

TBDuses separatetmuxwindows as debugging REPLs; one for the script's process, and one for each subshell created by the script. This not only leaves the script's terminal alone for direct user interactions, but it also makes it possible to debug a shell pipeline, which could have multiple subshells running as parallel processes.

Multiple and conditional break points are possible by sourcingTBDmultiple times in the script. Setting conditional break points at runtime is also possible with the caveat that a break point set from a subshell on its parent process will have no effects.

See theexamples/fizzbuzzscript and/helpfor details.

Check out the demoasciicast

Prerequisites

You need to be running in atmuxsession already, and havebat,less, andtmuxinPATH.Of course, you should know how to usetmux;at least, you should know how to switch betweentmuxwindows.

Installation and Usage

Currently, there's no automatic installation; just clone the repo, addtbd.shandtbd-view somewhere inPATH,and make both executable. For example:

git clone [email protected]:kjkuan/tbd.git
cdtbd&&PATH=$PWD:$PATH

To use it, simplysource tbd.shsomewhere in your script, and run your script from atmuxwindow; follow the on-screen help, or enter/help,for instructions. See also thedemoabove.