I'd like to be able to print the current line number in a shell script. I know about the $LINENO variable in Bash shells, but it doesn't seem to exist in Bourne shells. Is there any other variable or way I can get the line number?
Take the 2-minute tour
×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
|
||||
|
|
|||
|
|
|
You could post-process your script
But it usually causes problems with having to maintain the template and generate the script each time you want to make edits. |
|||
|
|
shhas theLINENOvariable, so it certainly exists in some places... – D_Bye Sep 28 '12 at 16:32shis a link tobashthen it will have mostbashfeatures. – jw013 Sep 28 '12 at 17:21