On 13 May 2010 16:23, erik quanstrom <quans...@labs.coraid.com> wrote: >> > echo 1 2 | hoc -e '{while(read(x) != 0)y += x' ^ $nl ^ ' print y, "\n"}' >> >> Maybe it makes a sense to add in hoc(1) expression delimiter like a ';'? > > i don't use hoc very often. i tend to use acid. (!) > this is because hoc won't do bit operations and doesn't > accept hex. > > i typically do programming calculations and floating point > just isn't the right way to do that. > > - erik > >
I've used hoc in my scripts to prepare some values which are then used one for a calculation and second for naming a directory after this value: v = `{hoc -e $min+$step'*('$i-1')'} mkdir $v However, even for min=0 and step=0.05 (if I remember it right) for some i I get a value like 6.50000000000something, which is annoying to correct. That was the reason for my original question. As proposed I will either add awk to format the result or use awk exclusively in scripts. Nonetheless, maybe some control over the format in hoc could be handy... Thanks Ruda