programming a calculator with bash
hi, i am trying to program a calculator,
************************************************** #!/bin/bash echo "(($1))" *************************************************** .. and that is my whole program, works fine wth integers, but with decimals it would show error, can any help with calculating with decimals? |
echo "2.101592 + 1.04" | bc
|
Code:
#!/bin/bash ---------------------------- Code:
#!/bin/bash Code:
alias calc='sh /home/crouse/scripts/bashcalc.sh' Quote:
|
| bc, can you explain that part?
|
| is the PIPE command . It runs the output of the previous command into the next command. In this case ... bc.
As for bc, direct from the man pages... Quote:
|
All times are GMT -5. The time now is 05:44 PM. |