Quote:
Now I've reverted to echoing key variable names as required and sometimes to short set -xv blocks. Using command output capture to tell the user about progress (on screen and log) identifies the part of the script that failed quite closely. |
Ah, but with your experience, you usually have a good idea which parts are (probably) going wrong. Initially, for new users or really obscure problems, one set -xv at the top is highly informative. You can always be more specific later.
|
Absolutely. Actually, day or two before I started this thread I tried "bash -x <scriptname>".
But frankly, I believe that nothing beats good echo command with custom text like: Code:
echo "Variable K after the change is "$K I know it is not really pretty, but my way of thinking allowed me to reuse those echo commands, and after year or two when I try to change something, expand that database text file maybe, I will be able to debug it with lesser output deciphering. |
FWIW I also have a debugging function call trace in my big scripts
Code:
#-------------------------- Code:
debug='NO' Code:
fct "${FUNCNAME[ 0 ]}" "started with idx=$1" Code:
fct "${FUNCNAME[ 0 ]}" "returning. \$dev_afn is '$dev_afn'" |
Noted and saved to recently started bash code repository. Thanks.
|
All times are GMT -5. The time now is 12:35 PM. |