享受过程
2016-06-21 21:10
#!/bin/bash read -t 30 -p "please inputA" read -t 30 -p "please inputB" read -t 30 -p "please choose +/-/*//:" C case $C in "+") echo$(($A+$B)) ;; esac
没有将键盘输入的值赋给变量A和B,改成下面的就行了
#!/bin/bash
read -t 30 -p "please inputA" A
read -t 30 -p "please inputB" B
read -t 30 -p "please choose +/-/*//:" C
case $C in
"+")
echo$(($A+$B))
;;
esac
#!/bin/bash
#echo "1.$12.$23.$3"
if [ "$2" == "+" ]
then
RES=`expr $1 + $3`
echo ">>the result is:$RES"
elif [ "$2" == "-" ]
then
RES=`expr $1 - $3`
echo ">>the result is:$RES"
Linux达人养成计划 I
399344 学习 · 3791 问题
相似问题