2
我想写一个脚本来跟踪文件更改的进度。UNIX shell脚本while循环
我有以下至今:
#!/bin/sh
old=‘ls -l /tmp/file‘
new=‘ls -l /tmp/file‘
while [ "$old" = "$new" ]
do
new=‘ls -l /tmp/file‘
done
echo "The file has been changed"
运行时给出了消息的上述程序:
new: command not found
能有人帮。
感谢
你可能想' “$老” -eq “$新的”' –
@Marc,不,在壳'='是字符串比较和'-eq'是数值比较。 –
@Mike,你可能想在你的while循环中抛出一个'sleep 5'。 –