Utilizing bash to multiply an interger by a float with an if statement, I will further expand on this with two other cases outside 0.90, just trying to learn the basics.
#!/bin/bash echo -n "give me an integer: [ENTER]: " read that_integer if -n [ $that_integer <= 5000 ]; then awk print $that_integer*0.90 done Ultimately, this is the code I came up with.
Thanks!
#!/bin/bash echo "give me an integer: [ENTER]: " read that_integer if [ $that_integer -le 5000 ]; then awk -v x=$that_integer 'BEGIN { print x*0.90 }' < /dev/null elif [ $that_integer -gt 5000 -a $that_integer -le 50000 ]; then awk -v x=$that_integer 'BEGIN { print x*0.70 }' < /dev/null else awk -v x=$that_integer 'BEGIN { print x*0.40 }' < /dev/null fi done
awk -v i=$that_int 'BEGIN{if (i<5000) print i*.9 else if (i>5000 && i <=50000) print i*.7 else print i*.4}'Good luck and keep poinsting.