我尝试使用bash做一个简单的比较,以检查一行是否为空:
line=$(cat test.txt | grep mum )
if [ "$line" -eq "" ]
then
echo "mum is not there"
fi但它不起作用,它说:[:太多参数
非常感谢你的帮助!
发布于 2010-07-21 23:28:45
if line=$(grep -s -m 1 -e mum file.txt)
then
echo "Found line $line"
else
echo 'Nothing found or error occurred'
fihttps://stackoverflow.com/questions/3300633
复制相似问题