bug-gnu-utils
[Top][All Lists]
Advanced

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

FW: How can I export a variable from awk to a shell script


From: Benoit.Sudan
Subject: FW: How can I export a variable from awk to a shell script
Date: Thu, 15 Jun 2006 13:45:56 +0200

> Hello Everybody,
> 
> Is it possible to generate a variable into an awk command et export it to a 
> shell script ? I assume that I use nawk but maybe it's the same in gawk.
> 
> Thanks for your help
> 
> BenoƮt
> 
> 
> example of script:
> 
> nawk -v dirvar=/opt \
>      'BEGIN {while("find "dirvar" -name db2ilist" | getline)
>                     /instance/
>                     dir=$0
>                     "DIR="dir "; export DIR"                  <== try to 
> export to shell script but doesnt work
>                     print dir}'
> 
> print "DIR=${DIR}"
> 
> 
> example of run:
> 
> + nawk -v dirvar=/opt -v dir= BEGIN {while("find "dirvar" -name db2ilist" | 
> getline)
>                      /instance/
>                      dir=$0
>                      "DIR="dir "; export DIR"
>                      print dir}
> /opt/IBM/db2/V8.1/instance/db2ilist                                   <== 
> result of print dir (intern awk)    
> + print DIR=
> DIR=                                                                          
> <== result of print ${DIR} (shell script)
> 
> 
> 
> 
> 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]