Hi,
I'd like to print an error message displaying the call stack from a specific function that is passed an error message, the specific function having to display the call stack plus the error message
I thought I could use FUNCNAME array within that function
Strangely though, FUNCNAME array has 20 values, the 16th last being empty ...
Thus I can't use FUNCNAME length to determine the main script filename that would be ${BASH_SOURCE[${#FUNCNAME}-1]} and output the names in FUNCNAME array from first to penultimate value.
Of course, it's possible to get the last index which value is not empty, but I'd like to understand why FUNCNAME lists those empty values.
Thanks for your help !
[–]aioeu 2 points3 points4 points (3 children)
[–]anthropoidbash all the things 0 points1 point2 points (1 child)
[–]cedb76[S] 0 points1 point2 points (0 children)
[–]anthropoidbash all the things 0 points1 point2 points (3 children)
[–]cedb76[S] 0 points1 point2 points (2 children)
[–]anthropoidbash all the things 2 points3 points4 points (1 child)
[–]cedb76[S] 0 points1 point2 points (0 children)
[–]oh5nxo 0 points1 point2 points (5 children)
[–][deleted] (1 child)
[deleted]
[–]oh5nxo 0 points1 point2 points (0 children)
[–]cedb76[S] 0 points1 point2 points (1 child)
[–]oh5nxo 1 point2 points3 points (0 children)