1.比较两个图片是否一样
file1="xxx/333.png"
file2="xxx/num_0.png"
temp=`cmp $file1 $file2`
if [ "$temp" == "" ]; then
echo same
else
echo different
fi
2.文件判断
if [ -s "tt.txt" ]; then
echo "文件不为空"
fi
if [ ! -s "tt.txt" ]; then
echo "文件为空"
fi
if [ -e "tt.txt" ]; then
echo "文件存在"
fi
if [ ! -s "tt.txt" -a -e "tt.txt" ]; then
echo "文件为空&&存在"
fi
3.判断语句里取变量值
filename="date.txt"
if [ ! -e "$filename" ]; then
touch "$filename"
fi
if [ ! -e $filename ]; then
touch "$filename"
fi
if [ ! -e '$filename' ]; then
touch "$filename"
fi
for i in $zipset;
do
echo " --------------- "
done