执行sh in.sh,提示“too many arguments”
[quote][ec2-user@webserver wdcp]$ sudo sh in.sh
[color=Red]in.sh: line 8: [: too many arguments[/color]
Select Install
1 apache + php + mysql + zend + eAccelerator + pureftpd + phpmyadmin
2 nginx + php + mysql + zend + eAccelerator + pureftpd + phpmyadmin
3 nginx + apache + php + mysql + zend + eAccelerator + pureftpd + phpmyadmin
4 install all service
5 don't install is now
Please Input 1,2,3,4,5:[/quote]
in.sh中的内容是:[code]#!/bin/bash
###
if [ $UID != 0 ];then
echo "You must be root to run the install script."
exit
fi
if [ $1 == "un" -o $1 == "uninstall" ];then
service httpd stop
service nginxd stop
service mysqld stop
service pureftpd stop
service wdapache stop
mkdir /www/backup
bf=`date +%Y%m%d`
tar zcvf /www/backup/mysqlbk_$bf.tar.gz /www/wdlinux/mysql/var
rm -fr /www/wdlinux
rm -f /tmp/*_ins.txt
reboot
exit
fi
chmod 755 lanmp.sh
chmod 755 wdcp_ins.sh
./lanmp.sh | tee lanmp_ins.log
./wdcp_ins.sh | tee wdcp_ins.log
[/code] 系统是RedHat ELS 6.4 能安装完吗 将"[ ]"替换成"[[ ]]"试试 [quote]能安装完吗
[size=2][color=#999999]admin 发表于 2013-7-16 09:10[/color] [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=25670&ptid=6509][img]http://www.wdlinux.cn/bbs/images/common/back.gif[/img][/url][/size][/quote]
我打开in.sh 把最后两句话分别用sudo执行 成功安装了
[quote]将"[ ]"替换成"[[ ]]"试试
[size=2][color=#999999]marquis 发表于 2013-7-16 11:54[/color] [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=25681&ptid=6509][img]http://www.wdlinux.cn/bbs/images/common/back.gif[/img][/url][/size][/quote]
thx [code]if [ $1 == "un" -o $1 == "uninstall" ];then[/code]修改为:[code]if [ "$1" == "un" -o "$1" == "uninstall" ];then[/code]可以解决运行in.sh出现[: too many arguments错误。
页:
[1]