current line number in shell script

Hi

I am using korn shell is there a built in or ny other way to get the current line number so i can write the current line number to the logfile to aid in debugging like

logmsg $lineno $date

logmsg is a helper function that helps in logging messages to a log file

regards

Use the $LINENO variable

Hi

wow what a elegant and simple solution thanks for letting me know of this

regards

You could just use:

#!/bin/ksh
export PS4='$0 $LINENO >>'
set -x

This prints every line executed and shows the variables and results