【发布时间】:2021-05-10 22:36:28
【问题描述】:
echo "Enter the number"
read $num
echo "number in reverse order is : "
ten=10
while [[ $num -gt 0 ]];
do
echo $((num%ten))
num=`expr $num / 10`
done
我在 mac 终端上运行这个 终端上没有打印或回显。以相反顺序打印数字的问题。 请帮帮我,我已经受够了,如果有人能在这方面向我推荐一些好的内容,我将不胜感激。
【问题讨论】:
-
您应该考虑在发帖前使用shellcheck 解决某些问题...提示:
read $num不起作用,您不要在作业中使用$。