Register
It is currently Tue Oct 21, 2014 7:34 am

how to delay variable expansion?


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Tue Feb 17, 2009 3:44 pm   

Joined: Tue Feb 17, 2009 12:47 pm
Posts: 3
Hello -

I have a bash script that uses "logger" to log messages. Te way I am using it is:
MYNAME=$0
MYPID=$$
LOGGER="/usr/bin/logger -t $MYNAME[$MYPID]($LINENO) -p daemon.error"

...

echo 'some stuff' | $LOGGER

everything works properly, but the (built-in) $LINENO variable is expanded on the "LOGGER" line instead of the "echo" line.

How would I cause the $LINENO expansion to be delayed, or protected, until the echo command?

Thanks for your help!


Top
 Profile WWW  
 PostPosted: Wed Feb 18, 2009 2:11 am   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
If you know this is the case in all situations why not just make a quickfix hack for it?

let current_line=LINENO-1

or something like that.

Best regards
Fredrik Eriksson


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP