我在循环内部无法传递变量。
代码:
# find all output.txt that has been modified last 24h ...
PROCESSED=1
find ${PROCESSED_DIR} -mtime -1 -name "output.txt" | while read i
do
# .. and compare those with TMP_TXT
if diff $i ${TMP_TXT} > /dev/null
then
# If both are same EXIT search loop
PROCESSED=0
exit
fi
done
echo "PROCESSED=${PROCESSED}"
这将始终输出1。有什么办法可以使PROCESSED=0吗?
这是在Solaris 9机器上完成的。