Skip to content

noqqe/minimal-bash-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

minimal-bash-debug

as its name implies: this is your minimal bash debugger. minimal-bash-debug is simple to implement and to use. just by adding a short bash snippet and it's minimal syntax.

there are a lot of techniques for bash scripters to debug thier code and here's mine.

install

cd path/to/your/bashscript
wget http://github.com/noqqe/minimal-bash-debug/raw/master/.minimal-bash-debug 
chmod +x .minimal-bash-debug    

usage

just ad:

debug() {
  debug=2 # set debug level 0|1|2|3
  if [ -x .minimal-bash-debug ]; then
  ./.minimal-bash-debug $debug $1 $2 "$3"
  fi
}

to your bashscript and use:

debug 1 echo "variable foo is $foo"
debug 3 syslog "variable bar is $bar"

debugging

you could print your debug message to syslog or just to your screen..or both. switch on/off your debugging easily. please see example.sh for further informations.

About

a minimal bash debugger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages