[sh] How can function find invoking line # ?
- From: kj <no.email@xxxxxxxxxxx>
- Date: Mon, 25 Jun 2012 01:00:12 +0000 (UTC)
I would like to write a "die" function (as part of a /bin/sh script)
that starts out by printing out the line from which it was called
(and after doing some cleanup, exits with 1). The intended usage
is like this:
foo bar baz || die "foo failed"
It would be OK if the line number were an argument to the function:
foo bar baz || die 42 "foo failed"
....but hard-coding the line numbers makes editing the script very
Is there some special shell variable corresponding to the number
of the line that is currently executing?
Alternatively, is there any way for the die function to determine
the line it was called from?
- Prev by Date: Re: SSH issue: how to make it run with a different shell
- Next by Date: Re: [sh] How can function find invoking line # ?
- Previous by thread: SSH issue: how to make it run with a different shell
- Next by thread: Re: [sh] How can function find invoking line # ?