As part of a larger script, I want to get a numerical value stored in a text file on the web, , then open a terminal window, display that value, and send it to bc so I can interactively do calculations on it.
I came up with this:
konsole --hold -e curl http://mysite/num.txt | bc
but if I run the part after konsole I get the output
(standard_in) 1: syntax error
If I execute the script containing this line, I get the display of the number from curl, but I think it tries to pipe the entire line (including konsole) to bc, which I believe would only happen once I close the terminal window - so that doesn't help.
How can I get the number into bc? I'd be open to commands other than curl and bc to accomplish this basic goal.
If
curl http://mysite/num.txt
outputs a new line character at the end, you'd have to remove it.