bash variable expansion moment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



It's half a nice Saturday later and many attempts have brought no
satisfaction.  Maybe this can't be done.

I'm trying to write a function which, when called from one function
execute in another.  In itself, that's not the problem.  Rather, there's
one built-in variable which is evaluated in the function definition and
it's value is then set (too early).

Here's the one file (func-file):
-------------------------
Line()
{
echo This is line "$LINENO" $@
}
-------------------------

That one is called by this one:
-------------------------
#!/bin/bash

. ./func-file

Line ... it should be $LINENO
------------------------

I want the function Line to show the line number in the second file
where it's executed, not the line number from the sourced function.

Any mavens got the skinny on this?

tia


-- 
War is a failure of the imagination.
        --William Blake

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux