Bash shell script to perform the arithmetic operations
codeaft.sh
#!/bin/bash echo -n "10+20 = "; expr 10 + 20 echo -n "10-20 = "; expr 10 - 20 echo -n "10\*20 = "; expr 10 \* 20 echo -n "10/20 = "; expr 10 / 20
Output
codeaft@codeaft:~$ bash codeaft.sh 10+20 = 30 10-20 = -10 10\*20 = 200 10/20 = 0 codeaft@codeaft:~$
Bash shell script to perform the arithmetic operations
codeaft.sh
#!/bin/bash echo $((10 + 20)) echo $((10 - 20)) echo $((10 * 20)) echo $((10 / 20))
Output
codeaft@codeaft:~$ bash codeaft.sh 30 -10 200 0 codeaft@codeaft:~$
Bash shell script to perform the arithmetic and relational operations
codeaft.sh
#!/bin/bash expr '10' '+' '20' expr '10' '<' '20' expr '10' '>' '20' expr '10' '<' '10' expr '10' '<=' '10' expr '10' '>=' '20'
Output
codeaft@codeaft:~$ bash codeaft.sh 30 1 0 0 1 0 codeaft@codeaft:~$
Comments and Reactions