I'm trying to do floating point arithmetic in a shell script. I learned that awk can do it on the command line, but the way it works there does not seem to carry over to a shell script. When I type awk below, it turns gray, as if to say that bash doesn't recognize it. When I run it, $ ./script a 30 40, I get 0. What am I doing wrong?
#!/bin/bash if [ $1 = a ] then echo | awk '{print $2 + $3}'
echodo in general? So what doesechodo in your script?