Re: [CentOS] bash variable expansion moment

2009-11-23 Thread Philip Gwyn
On 16-Nov-2009 ken wrote: > On 11/15/2009 06:32 PM Stephen Harris wrote: >> On Sun, Nov 15, 2009 at 06:21:40PM -0500, ken wrote: >> >> >> echo This is line "${BASH_LINENO[0]}" $@ >> >> > > That's all I needed. Thanks. You might also want to check out bash's built in `cal

Re: [CentOS] bash variable expansion moment

2009-11-16 Thread ken
On 11/15/2009 06:32 PM Stephen Harris wrote: > On Sun, Nov 15, 2009 at 06:21:40PM -0500, ken wrote: > >>> > > echo This is line "${BASH_LINENO[0]}" $@ > > That's all I needed. Thanks. ___ CentOS mailing list CentOS@centos.org http://

Re: [CentOS] bash variable expansion moment

2009-11-16 Thread Todd Denniston
ken wrote, On 11/14/2009 07:37 PM: > 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

Re: [CentOS] bash variable expansion moment

2009-11-15 Thread Stephen Harris
On Sun, Nov 15, 2009 at 06:21:40PM -0500, ken wrote: > > Is this what you wanted to do? > > Stephen, thanks for your reply, but you're not seeing what I want to do. > Let me post my example once again: You're not reading what I wrote. > - > Line() > { > echo This is lin

Re: [CentOS] bash variable expansion moment

2009-11-15 Thread ken
On 11/15/2009 02:22 PM Stephen Harris wrote: > On Sun, Nov 15, 2009 at 01:50:30PM -0500, ken wrote: >> The problem is that $LINENO is evaluated in the function definition, and >> not when called. So I'm thinking to change "$LINENO" in the function > > No it's not. Variables are _not_ evaluated w

Re: [CentOS] bash variable expansion moment

2009-11-15 Thread Stephen Harris
On Sun, Nov 15, 2009 at 01:50:30PM -0500, ken wrote: > The problem is that $LINENO is evaluated in the function definition, and > not when called. So I'm thinking to change "$LINENO" in the function No it's not. Variables are _not_ evaluated when the function is defined; they're evaluated at exe

Re: [CentOS] bash variable expansion moment

2009-11-15 Thread ken
On 11/15/2009 08:54 AM Stephen Harris wrote: > On Sun, Nov 15, 2009 at 08:23:59AM -0500, ken wrote: >> A function containing environmental variables in one file would be >> called in another file. The function would, then, pass (e.g.) $LINENO >> as if it were a literal, but in the line where $Line

Re: [CentOS] bash variable expansion moment

2009-11-15 Thread Stephen Harris
On Sun, Nov 15, 2009 at 08:23:59AM -0500, ken wrote: > A function containing environmental variables in one file would be > called in another file. The function would, then, pass (e.g.) $LINENO > as if it were a literal, but in the line where $Line is invoked it would > be evaluated and the value

Re: [CentOS] bash variable expansion moment

2009-11-15 Thread Geerd-Dietger Hoffmann
On Sun, Nov 15, 2009 at 1:23 PM, ken wrote: > Joshua, > > Thanks for the reply.  But while what you offer would indeed work, but > it's not what I was looking for. > > I simplified my example for clarity, was looking to put other text and > variables in Line(), this in order to greatly simplify th

Re: [CentOS] bash variable expansion moment

2009-11-15 Thread ken
Joshua, Thanks for the reply. But while what you offer would indeed work, but it's not what I was looking for. I simplified my example for clarity, was looking to put other text and variables in Line(), this in order to greatly simplify the code which calls it. To rephrase what I'm trying to do

Re: [CentOS] bash variable expansion moment

2009-11-15 Thread Joshua Gimer
You could pass the value of $LINENO to Line() as a function argument: Here's the one file (func-file): - Line() { echo This is line $@ } - That one is called by this one: - #!/bin/bash . ./func-file Line $LINENO ---

[CentOS] bash variable expansion moment

2009-11-14 Thread ken
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 fu