shell 问题(求助)
下面的
#!/bin/sh
while [ test -r a ]
do
echo "file a has no been deleted!"
sleep 10
done
echo "file a has been deleted!"
运行 2.sh
之后结果
2.sh: line 1:[: -f: binary operator expected
file a has been deleted!
问题1:
出现的错误是为什么?
问题2:
sleep 10 是休息10秒?
#!/bin/sh
while [ test -r a ]
do
echo "file a has no been deleted!"
sleep 10
done
echo "file a has been deleted!"
运行 2.sh
之后结果
2.sh: line 1:[: -f: binary operator expected
file a has been deleted!
问题1:
出现的错误是为什么?
问题2:
sleep 10 是休息10秒?
作者: h200952709 发布时间: 2011-06-10
回复 h200952709
1. while [ -r a ]
2. 是
1. while [ -r a ]
2. 是
作者: yinyuemi 发布时间: 2011-06-10
1、while [ test -r a ] 语法错误,有了[]就不需要再加test
2、man sleep
复制代码
2、man sleep
- sleep - delay for a specified amount of time
作者: where27 发布时间: 2011-06-10
OK 明白了
作者: h200952709 发布时间: 2011-06-10