./P4.1: line 10: +: Syntax error: operand expected (error token is "+")
这是我的代码:
#!/bin/bash read string echo $string >| temp num1= cut -d" " -f1 temp num2= cut -d" " -f2 temp num3= cut -d" " -f3 temp while [ $num1 -gt $num3 ] do echo $num1 num1=$[$num1+$num2] done
怎么了,我该如何解决? 谢谢。
我如何确保正在运行的进程正在运行?
这个bash语法是什么意思? (特点:案件,执行)
是否有可能重写hashbang / shebangpath行为
如何在linux中模拟挂起的任务?
Bash脚本在terminal中手动运行,但不从crontab执行
有没有办法知道Linux中的init脚本存储在哪里?
“〜/ Desktop / test.txt:没有这样的文件或目录”
知道最近一周有多less用户连接到我的电脑,以及每个用户连接了多less时间
Bash脚本执行多个命令
crontab的行为差异为MysqL
ceving和Tomek's的结合:
#!/bin/bash read num1 num2 num3 while [ $num1 -lt $num3 ] do echo $num1 num1=$((num1+num2)) done
数字计算使用圆括号:
num1=$((num1 + num2))
#!/bin/bash read string echo "${string}" >| temp num1= cut -d" " -f1 temp num2= cut -d" " -f2 temp num3= cut -d" " -f3 temp while [ "${num1}" -gt "${num3}" ] do echo "${num1}" num1=$(expr "${num1}" + 1) done
另外,引用和支撑你的变量。 :d
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。