You could pass the value of $LINENO to Line() as a function argument:<br><br>Here's the one file (func-file):<br>
-------------------------<br>
Line()<br>
{<br>
echo This is line $@<br>
}<br>
-------------------------<br>
<br>
That one is called by this one:<br>
-------------------------<br>
#!/bin/bash<br>
<br>
. ./func-file<br>
<br>
Line $LINENO<br>
------------------------<br><br>Macintosh-5:/tmp joshuagimer$ cat func-file <br>Line()<br>{<br>echo This is line $@<br>}<br>Macintosh-5:/tmp joshuagimer$ cat test.sh <br>#!/bin/bash<br><br>. ./func-file<br><br>Line $LINENO<br>
Macintosh-5:/tmp joshuagimer$ bash test.sh <br>This is line 5<br><br>Thanks<br>Josh<br><br><div class="gmail_quote">On Sat, Nov 14, 2009 at 5:37 PM, ken <span dir="ltr"><<a href="mailto:gebser@mousecar.com">gebser@mousecar.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">It's half a nice Saturday later and many attempts have brought no<br>
satisfaction.  Maybe this can't be done.<br>
<br>
I'm trying to write a function which, when called from one function<br>
execute in another.  In itself, that's not the problem.  Rather, there's<br>
one built-in variable which is evaluated in the function definition and<br>
it's value is then set (too early).<br>
<br>
Here's the one file (func-file):<br>
-------------------------<br>
Line()<br>
{<br>
echo This is line "$LINENO" $@<br>
}<br>
-------------------------<br>
<br>
That one is called by this one:<br>
-------------------------<br>
#!/bin/bash<br>
<br>
. ./func-file<br>
<br>
Line ... it should be $LINENO<br>
------------------------<br>
<br>
I want the function Line to show the line number in the second file<br>
where it's executed, not the line number from the sourced function.<br>
<br>
Any mavens got the skinny on this?<br>
<br>
tia<br>
<font color="#888888"><br>
<br>
--<br>
War is a failure of the imagination.<br>
        --William Blake<br>
<br>
_______________________________________________<br>
CentOS mailing list<br>
<a href="mailto:CentOS@centos.org">CentOS@centos.org</a><br>
<a href="http://lists.centos.org/mailman/listinfo/centos" target="_blank">http://lists.centos.org/mailman/listinfo/centos</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Thx<br>Joshua Gimer<br>