to demonstrate, open two command windows in you Mac and in one type this:
while true; do echo this better be a whole sentence > x1.txt; mv x1.txt x.txt; done
on the other, run this script:
while true
do
F=`cat x.txt`
echo $F
if [ "$F" = "this better be a whole sentence" ]
then
echo ok
else
echo bad
exit -1
fi
done
notice the output:
mpire@brwdbs02:~$ ./x.sh
this better be a whole sentence
ok
this better be a whole sentence
ok
ok
this better be a whole sentence
ok
this better be a whole sentence
ok
cat: x.txt: No such file or directory
bad
[~]
bad
mpire@brwdbs02:~$
No comments:
Post a Comment