Stefan Ritt wrote: |
Steve Jones wrote: |
Subst TotalRisk = $shell(echo $Risk1 + $Risk2 + $Risk3 > /tmp/elog_out)
What comes out with my simple echo or gawk line is "+ + " so it looks like the attributes are not getting passed into the $shell code? |
The reason is that the substitutions get evaluated from left to right, so first the shell is called with $Risk1, and because the shell by itself does a subsitution and $Risk1 is not defined on the unix system, the shell returns an empty string, leading to "+ +" as the result.
I changed that in the current SVN version, so we have first the attribute substitions, then then shell substitution. The "echo $Risk1..." will of course not work, since it gets substituted by elog as "echo 12 + 23 + 45" (or whatever the numbers are), and the "echo" will just return these numbers without adding them. To make the shell to add things, you would need to define the risks as environment variables for the shell, so I guess the "gawk" method will work better for you. I tried it and it worked fine for me. |
Sorry, I waSn't clear about just why I was using "echo". Since elog removes the /tmp/elog_shell temporary file I couldn't "see" what was actually being passed to the shell - gawk was giving me an error and I was flying blind. So I used echo to create my own temporary file.
Yes, gawk should now work -- I'l download and compile the latest and provide feedback.
Thanks! |