help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Enable debugging with "set -xv"


From: uzibalqa
Subject: Enable debugging with "set -xv"
Date: Fri, 12 May 2023 17:12:34 +0000

I have a script that contains a function that sources a bash library composed 
of several files.

utils-launch ()
 {
  source "${trkrc}/marinex.rc"
  source "${trkrc}/firefly.rc"
  source "${trkrc}/navaid.rc"
  source "${trkrc}/buranex.rc"

  source "${trkrc}/comseq.rc"
  source "${trkrc}/comint.rc"
 }

I would like to have an optional argument to enable debugging and code it such 
that if one 
wishes to control the level of debug, they will be able to do that on the file 
they want.

Have made a function for debugging

debug ()
 {

  if [ "$1" = "DEPLOY" ]; then
    ## Activate Debugging Mode displaying input lines as they are read.
    set -xv
    echo "Debug Mode deployed."
  elif [ "$1" = "CONCLUDE" ]; then
    ## Stop Debugging Mode in Bash
    set +xv
    echo "Debug Mode concluded."
  fi

 }







reply via email to

[Prev in Thread] Current Thread [Next in Thread]