Subject: | |
From: | |
Reply To: | |
Date: | Wed, 11 Sep 2013 21:23:13 +0200 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
James B. Byrne wrote:
> :SETVAR V1 "31.1"
> :SETVAR v2 "4.7"
> :XEQ SH.HPBIN.SYS;INFO='-c "callci setvar result $(echo ""!V1 * !V2"" | bc |
> cut -f1 -d.)"'
> :SHOWVAR RESULT
> RESULT = 146
Hmmm....
I wonder if it would be more efficient to save a couple of process creations...
:xeq /bin/awk "'BEGIN {print !V1 + !V2}'"
35.8
:xeq /bin/awk "'BEGIN {print int(!V1 + !V2)}'"
35
One could use a TEMP file to capture and input the result...
:xeq /bin/awk "'BEGIN {print int(!V1 + !V2)}'" >sum
:input result <sum
Or you could let awk output the SETVAR command...
:xeq /bin/awk "'BEGIN {printf(""setvar result,%i\n"", !V1 + !V2)}'" >cmd
:xeq cmd
Of course, you could also waste a child process by awk invoking callci setvar...
:xeq /bin/awk "'BEGIN {sum=int(!v1 + !v2); system(""callci setvar uv,"" sum)}'"
Okay okay... I'll shut up now ;)
Cheers, Lars.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|