On Fri, Sep 14, 2001 at 05:28:35PM +0200, Martin F Krafft wrote: > in bash, is it possible to identify the line number of a script, from > where a function has been called?
You have $LINENO, but it restarts counting from 1 in functions. But if you invoke the function with $LINENO as argument, the calling line number will be substituted and passed to the function. $ cat -n lineno_test.sh 1 #!/bin/bash 2 3 function myfn() 4 { 5 echo "this function has been called from line number #$1" 6 } 7 8 myfn $LINENO 9 10 exit 0 $ ./lineno_test.sh this function has been called from line number #8 $ -- BALI, Andra's GPG keyID: 78560E1C [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]