SUMMARY: passw awk variable to shell script
- From: Dave Markham <dave.markham@xxxxxxxxxx>
- Date: Tue, 31 Oct 2006 16:07:29 +0000
Thanks to all who responded.
I tried Johan Hartzenberg who suggested :-
echo $line | awk -F- ' ...... {print $1, $2}' | read BasePatch Rev
but this seemed to bum my script out with a test parameter somewhere.
Other people suggested just setting the vairable in shell e.g
DEBUG=`grep "^Debug" ${CONF} | awk '{ print $2 }'`; (thanks chris
hoogendyk)
but this was what i was trying to avoid as id need 2 lines.
The solution which seems to have worked and makes sense now is that awk
system commands will be acting as a sub process. The eval using
backticks has worked a charm :-
Heres code snippit :-
## Works but messy
#BasePatch=`echo $line |awk -F- '{print $1}'`
#Rev=`echo $line | awk -F- '{print $2}'`
## Below dont work. Trying to get rid of above 2 with 1
#####echo $line | awk -F- '{ system( "BasePatch=" $1 ) ; system( "Rev="
$2 )}'
## Below nearly works and perhaps should but isnt.
#####echo $line | awk -F- '{print $1,$2}' | read BasePatch Rev
## Below wins !
eval `echo $line | awk -F- '{ print "BasePatch=" $1 "; Rev=" $2 }'`
Thanks to all
_______________________________________________
sunmanagers mailing list
sunmanagers@xxxxxxxxxxxxxxx
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
- Prev by Date: Low level (?) error "Error int getting (TCGETA) tty params" executing scripts remotely with SSH and sudo
- Next by Date: Re: xntpd slewalways & daylight change
- Previous by thread: Low level (?) error "Error int getting (TCGETA) tty params" executing scripts remotely with SSH and sudo
- Next by thread: SUMMARY: Low level (?) error "Error int getting (TCGETA) tty params" executing scripts remotely with SSH and sudo
- Index(es):
Relevant Pages
|