多亏了这个参考,我才能得到一个带有通配符文件匹配的 if 语句。但是,我不明白这里的双星号到底在做什么:
files=$(ls /tmp/*.cache 2> /dev/null | wc -l)
if [ **"$files" != "0"** ]
then
echo "Cache files exist: do something with them"
else
echo "No cache files..."
fi
它只是否定了这个陈述,所以在这种情况下它是说'如果文件数不等于 0'?