LinuxSir.cn,穿越时空的Linuxsir!

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

error: if ["$c"="0"]

[复制链接]
发表于 2007-10-2 15:51:13 | 显示全部楼层 |阅读模式
[root@myhost down]# bash file.sh-s
bash file.sh-s
file.sh-s: line 7: [0: command not found
file.sh-s: line 12: [0: command not found
file.sh-s: line 16: [0=2]: command not found
file.sh-s: line 7: [1: command not found
file.sh-s: line 12: [1: command not found
file.sh-s: line 16: [1=2]: command not found
file.sh-s: line 7: [2: command not found
file.sh-s: line 12: [2: command not found
file.sh-s: line 16: [2=2]: command not found
[root@myhost down]# cat file.sh-s
cat file.sh-s
#!/usr/bin/bash
a=(core community extra)
for i in 0 1 2
do
ls -l .>file.cmp
c=$i
if ["$c" = "0"]
then
cat file.cmp
#|sed -e 's/^/http:\/\/mirrors.lcuc.org.cn\/archlinux\/core\/os\/i686\//'>file.${a[$i]};
fi
if ["$c" = "1"]
then
cat file.cmp|sed -e 's/^/http:\/\/mirrors.lcuc.org.cn\/archlinux\/community\/os\/i686\//'>file.${a[$i]};
fi
if ["$c"="2"]
then
cat file.cmp|sed -e 's/^/http:\/\/mirrors.lcuc.org.cn\/archlinux\/extra\/os\/i686\//'>file.${a[$i]};
fi
done
exit 0
发表于 2007-10-2 15:55:57 | 显示全部楼层
注意空格的使用
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-10-2 16:03:35 | 显示全部楼层
now the following is ok.
if (($c==0))
then
cat file.cmp
fi
回复 支持 反对

使用道具 举报

发表于 2007-10-2 22:02:36 | 显示全部楼层
if [ "$c" = "0" ]
回复 支持 反对

使用道具 举报

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

本版积分规则

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