Code Comments
Programming Forum and web based access to our favorite programming groups.More universal approach to pass any strings in unix is, e.g.
#!/bin/ksh
env_var="New Year"
year="2004"
awk "
BEGIN{
x=\"${env_var}\";
printf(\"msg: %s\n\",x);
year=\"${year}\";
year++;
printf(\"%ld\n\",year);
exit;
}
"
exit 0 #### EOF Script
-Joseph
Post Follow-up to this messageIn article <1103911244.795726.221390@f14g2000cwb.googlegroups.com>, Joseph <jshkolni@hotmail.com> wrote: % More universal approach to pass any strings in unix is, e.g. [to put the awk script in double-quotes and escape every ", $, `, and \.] I don't really know what you mean by universal, but I don't think it's well-advised to take this approach. All the escaping makes things harder to read, and it's quite error-prone. It's much better to assign values to variables on the awk command-line, or pass them through the environment. -- Patrick TJ McPhee North York Canada ptjm@interlog.com
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.