LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 571|回复: 1

请教for in语句

 关闭 [复制链接]
发表于 2007-1-7 17:53:23 | 显示全部楼层 |阅读模式
#!/bin/bash
for abc in "a b" "c d" "e f"
do
echo "hello!$abc"
if [ $abc -eq "c d" ]
then
echo "abcdef"
fi
done
这样写为什么if语句会是错的呢?实在不明白,请教了。
发表于 2007-1-11 09:08:50 | 显示全部楼层
-eq is used for comparing numbers. string uses '=, !=, etc...'
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表