这是我的 Unix shell 脚本代码
#! /bin/ksh
echo "Enter your first number:"
read first
echo "Enter your second number:"
read second
echo "Enter your third number:"
read third
SUM=`expr $first + $second + $third`
AVERAGE="$SUM/3"
echo "The average is $AVERAGE"
Run Code Online (Sandbox Code Playgroud)
基本上我想找到用户输入的 3 个值的平均值。输入所有值后得到的结果,例如所有值加起来为 12;是“平均值是12/3”。