The awk program do generate shell script..  it  genetates "tar" command
with ISO date on it($ISODATE). The  ISO date tells when the back was taken.
  Anyway, I am putting the export on the "tar" script.





             "Edmund R.
             MacKenty"
             <[EMAIL PROTECTED]                                          To
             etSoftware.com>           [email protected]
             Sent by: Linux on                                          cc
             390 Port
             <[EMAIL PROTECTED]                                     Subject
             ist.edu>                  Re: awk question


             01/03/2006 10:16
             AM


             Please respond to
             Linux on 390 Port
             <[EMAIL PROTECTED]
                 ist.edu>






John Summerfied writes:
>Eddie Chen wrote:
>> I am trying  to export a varable from awk and is not taken an effect
when I
>> do  "env" once I exit from the awk  program.
>>
>>   system(export ISODATE=`date --iso-8601`) or I think I also try
"export
>> ISODATE=`date --iso-8601` | getline isodate "
>>
>> how do I set ENV varable in awk ...
>
>A program cannot change its parent's environment.
>
>A workaround is to write shell command(s) to a temp file then source it.
>
>In bash,
>help source

Or, if your awk script does not generate any output, you could have it
output the value and use this shell idiom to set an environment variable in
the parent:

             export ISODATE=`awk '...system("date --iso-8601"); ...'`

It is not clear to me why you need to use awk to set the environment
variable.  Is it possible to just have the parent shell script set it
before running awk?  As in:

             export ISODATE="`date --iso-8601`"

That makes the variable available to both your shell script and the awk
program.

Or is something in your awk script deciding to use the ISO 8601 date format
instead of some other date format?  If so, consider refactoring your awk
script.
             - MacK.
-----
Edmund R. MacKenty
Software Architect
Rocket Software, Inc.
Newton, MA USA

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or
visit
http://www.marist.edu/htbin/wlvindex?LINUX-390



-----------------------------------------
This message and its attachments may contain  privileged and
confidential information.  If you are not the intended recipient(s),
you are prohibited from printing, forwarding, saving or copying this
email.  If you have received this e-mail in error, please immediately
notify the sender and delete this e-mail and its attachments from your
computer.

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to