我正在通过 shell 脚本从文件中读取字符串。它是这样的:
count = 0
while read LINE
do
count++
if [ "$LINE" == "NONE" ]
then
echo "state is NONE"
else
if [ "$LINE" == "PLAYING" ]
then
echo "state is PLAYING"
fi
fi
done<$FILENAME
这是我从文件中读取的内容,以及我如何处理它,现在如果找不到文件,我想做其他事情,有什么办法吗?例如:
if[ file not found]
then
do something
fi