home | list info | list archive | date index | thread index

is there a simpler way to add debugging statements to a bash script?

  • Subject: is there a simpler way to add debugging statements to a bash script?
  • From: "Robert P. J. Day" <rpjday [ at ] crashcourse [ dot ] ca>
  • Date: Thu, 24 Oct 2019 19:49:07 -0400 (EDT)
  currently working with an existing set of bash scripts and i want to
add some simple debugging functionality that makes it way easier to
print the value of variables whenever i want.

  rather than adding numerous "echo" lines, i whipped up some
functions that allow one to just ask to "dump" a variable of any type,
and it will do the right thing.

  i wrote it up here:

https://crashcourse.ca/dokuwiki/doku.php?id=shell_dump_function

where you can see how the bash dump() function has to first identify
the type of variable to know how to properly dump it.

  cutting to the chase, is there a simpler way to do this? this seems
to work, but i'm wondering if i'm missing something far simpler.

  thoughts?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org