Bash variable ${LINENO} show the line number in the current script which useful when debugging scripts. Like: #!/bin/bash echo .. foo bar echo “${LINENO}” # print 4
Bash variables that I find useful for debugging are;
${BASH_COMMAND} → Last command ran
${BASH_LINENO[@]} → List line numbers up to that point
${FUNKNAME[@]} → List functions in stack
${BASH_SOURCE[@]} → List files in stack
Filed under: Uncategorized - @ December 30, 2021 3:06 pm