我写一个简单的UNIX shell脚本:UNIX shell脚本:UDV
#!/bin/bash
# abort the script if a command fails
set -e
# abort the script if an unitialized shell variable is used
set -u
i = 0;
while [$i -l 1]
do
src/meshpro input/martini.off video/noise/image$i.off -noise $i
src/meshview video/noise/image$i.off -output_image video/noise/image$i.jpg -exit_immediately
i='expr $i + 0.1'
done
当我尝试运行该脚本,我得到以下错误:line 14: i: command not found
。我使用了一个教程来应用于我的代码。任何建议我做错了什么?
我是否允许增加一个非整数值的东西,就像我正在处理变量i一样? – Myx 2010-03-07 23:03:17
是的,但不适用于'expr'。试试'bc'。 – 2010-03-07 23:05:07
谢谢=)我试过bc(i ='bc $ i + 0.01'),但是我得到了第10行:[:while while循环的第二次运行时出现太多参数 错误。 – Myx 2010-03-07 23:12:16