ubuntu 10.10下 shell 脚本的循环问题
发表于 : 2011-01-07 15:44
初次接触shell脚本
使用ubuntu 学习shell 的循环命令 while
文件内容:
#!/bin/sh
x=1
while [$x -le 5]; do
echo "$x"
x=$(($x+1))
done
运行后却显示:
./test: 6: [1: not found
运行了好几个带while的程序,均显示同样的错误。
难道while 不能用?
请各位高手指教!
使用ubuntu 学习shell 的循环命令 while
文件内容:
#!/bin/sh
x=1
while [$x -le 5]; do
echo "$x"
x=$(($x+1))
done
运行后却显示:
./test: 6: [1: not found
运行了好几个带while的程序,均显示同样的错误。
难道while 不能用?
请各位高手指教!