FreeBSD-12.3p5
GNU bash, version 5.1.16(0)-release (amd64-portbld-freebsd12.3)
I am working on a
Now, it is quite evident that Line 9 is not the line number of the script where the problem is encounted. Using the textual context of the error message this is positively identified to be in this portion of the script:
My question is: Why is the trace displaying
GNU bash, version 5.1.16(0)-release (amd64-portbld-freebsd12.3)
I am working on a
bash
script and I wish to trace the execution to locate a problem. The default shell for the development user is also bash
. I am invoking the script from the command line using:
Code:
export PS4="Line $LINENO: " ; /usr/bin/bash --noprofile --norc -x ~/Projects/hll_powerhouse/freebsd/bash/email_invoices/email_invoices.sh -d 2022.05.25
LLine 9: basename /home/byrnejb_hll/Projects/hll_powerhouse/freebsd/bash/email_invoices/email_invoices.sh
Line 9: SCRIPT_NAME=email_invoices.sh
. . .
Line 9: case $OPTION in
Line 9: indate
Line 9: ARG_d=2022.05.25
Line 9: INV_DATE=2022.05.25
Line 9: is_valid_date 2022.05.25
Line 9: local _test_date
Line 9: _test_date=2022.05.25
Line 9: local _today
LLine 9: date +%Y%m%d
Line 9: _today=20220823
Line 9: '[' 8 -gt 10 ']'
Line 9: '[' 8 -lt 10 ']'
Line 9: echo 'Date provided, 2022.05.25 is too long. Expected yyyy.mm.dd format'
Date provided, 2022.05.25 is too long. Expected yyyy.mm.dd format
Line 9: exit 4
Now, it is quite evident that Line 9 is not the line number of the script where the problem is encounted. Using the textual context of the error message this is positively identified to be in this portion of the script:
Code:
400 # check for eight digit date - \${#<string_var>} gives length of string
401 if [ 8 -gt "${#_test_date}" ]
402 then
403 echo "Date provided, $_test_date, is too short. Expected yyyy.mm.dd format"
404 exit 4
405 elif [ 8 -lt "${#_test_date}" ]
406 then
407 echo "Date provided, $_test_date is too long. Expected yyyy.mm.dd format"
408 exit 4
409 fi
410
My question is: Why is the trace displaying
Line9:
? Why does it not display the actual line numbers of the script?