[问题]如何写自动下载和安装软件的脚本?
-
- 帖子: 10
- 注册时间: 2008-02-24 10:09
- 来自: Northern Ireland
[问题]如何写自动下载和安装软件的脚本?
本人想写一个在UBUNTU和FEDORA上面自动下载和安装WINE的脚本,由于刚学SHELL SCRIPT 什么都不懂,无重入手。。。希望各位高手给个例子让小弟从中学习学习。。
- carbont
- 帖子: 3406
- 注册时间: 2007-11-22 10:20
- 来自: 北京
-
- 帖子: 10
- 注册时间: 2008-02-24 10:09
- 来自: Northern Ireland
硬着头皮写了这样一个SCRIPT,请问有什么地方不对呢?老是显示SELECT NOT FOUND
#!/bin/sh
echo "-------------------------------------------"
echo " | Wine & KeyNote Auto installer for Ubuntu & Fedora | "
echo "-------------------------------------------"
echo "What is your OS?"
select var in "Linux" "Fedora " " Other" ; do
read var
if test" $var" == "1" ;then
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
sudo wget http://wine.budgetdedicated.com/apt/sou ... hardy.list -O /etc/apt/sources.list.d/winehq.list
sudo wget http://wine.budgetdedicated.com/apt/sou ... /etch.list -O /etc/apt/sources.list.d/winehq.list
sudo apt-get upgrade
sudo apt-get install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
else if test" $var" == "2" ;then
yum upgrade
yum install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
else ;then
echo "Sorry these softwares can not be instaled in any other OS temporarily!"
fi
break
done
echo "Congratulation ! Now you can use KeyNote now!"
#!/bin/sh
echo "-------------------------------------------"
echo " | Wine & KeyNote Auto installer for Ubuntu & Fedora | "
echo "-------------------------------------------"
echo "What is your OS?"
select var in "Linux" "Fedora " " Other" ; do
read var
if test" $var" == "1" ;then
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
sudo wget http://wine.budgetdedicated.com/apt/sou ... hardy.list -O /etc/apt/sources.list.d/winehq.list
sudo wget http://wine.budgetdedicated.com/apt/sou ... /etch.list -O /etc/apt/sources.list.d/winehq.list
sudo apt-get upgrade
sudo apt-get install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
else if test" $var" == "2" ;then
yum upgrade
yum install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
else ;then
echo "Sorry these softwares can not be instaled in any other OS temporarily!"
fi
break
done
echo "Congratulation ! Now you can use KeyNote now!"
-
- 帖子: 10
- 注册时间: 2008-02-24 10:09
- 来自: Northern Ireland
选择菜单是出来了¬¬¬但是结果还有问题,我想是我的条件匹配问题吧?应该怎么改?
---------------------------------------------结果1
What is your OS?
1) Linux
2) Fedora
3) Other
#? 1
./test2.sh: line 16: test :找不到命令
./test2.sh: line 24: test :找不到命令
Sorry these softwares can not be instaled in any other OS temporarily!
jeryan@jeryan-laptop:~/桌面$
----------------------------------------------结果2
What is your OS?
1) Linux
2) Fedora
3) Other
#? 2
./test2.sh: line 16: test :找不到命令
./test2.sh: line 24: test :找不到命令
Sorry these softwares can not be instaled in any other OS temporarily!
jeryan@jeryan-laptop:~/桌面$
------------------------------------------结果3
What is your OS?
1) Linux
2) Fedora
3) Other
#? 3
./test2.sh: line 16: test :找不到命令
./test2.sh: line 24: test :找不到命令
Sorry these softwares can not be instaled in any other OS temporarily!
jeryan@jeryan-laptop:~/桌面$
---------------------------------------------
我的脚本:
#!/bin/bash
echo "-------------------------------------------"
echo " | Wine & KeyNote Auto installer for Ubuntu & Fedora | "
echo "-------------------------------------------"
echo "What is your OS?"
select var in "Linux" "Fedora " " Other" ; do
read var
if test" $var" == "1" ;then
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
sudo wget http://wine.budgetdedicated.com/apt/sou ... hardy.list -O /etc/apt/sources.list.d/winehq.list
sudo wget http://wine.budgetdedicated.com/apt/sou ... /etch.list -O /etc/apt/sources.list.d/winehq.list
sudo apt-get upgrade
sudo apt-get install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
elif test" $var" == "2" ;then
yum upgrade
yum install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
else
echo "Sorry these softwares can not be instaled in any other OS temporarily!"
exit
fi
done
echo "Congratulation ! Now you can use KeyNote now!"
exit 0
---------------------------------------------结果1
What is your OS?
1) Linux
2) Fedora
3) Other
#? 1
./test2.sh: line 16: test :找不到命令
./test2.sh: line 24: test :找不到命令
Sorry these softwares can not be instaled in any other OS temporarily!
jeryan@jeryan-laptop:~/桌面$
----------------------------------------------结果2
What is your OS?
1) Linux
2) Fedora
3) Other
#? 2
./test2.sh: line 16: test :找不到命令
./test2.sh: line 24: test :找不到命令
Sorry these softwares can not be instaled in any other OS temporarily!
jeryan@jeryan-laptop:~/桌面$
------------------------------------------结果3
What is your OS?
1) Linux
2) Fedora
3) Other
#? 3
./test2.sh: line 16: test :找不到命令
./test2.sh: line 24: test :找不到命令
Sorry these softwares can not be instaled in any other OS temporarily!
jeryan@jeryan-laptop:~/桌面$
---------------------------------------------
我的脚本:
#!/bin/bash
echo "-------------------------------------------"
echo " | Wine & KeyNote Auto installer for Ubuntu & Fedora | "
echo "-------------------------------------------"
echo "What is your OS?"
select var in "Linux" "Fedora " " Other" ; do
read var
if test" $var" == "1" ;then
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
sudo wget http://wine.budgetdedicated.com/apt/sou ... hardy.list -O /etc/apt/sources.list.d/winehq.list
sudo wget http://wine.budgetdedicated.com/apt/sou ... /etch.list -O /etc/apt/sources.list.d/winehq.list
sudo apt-get upgrade
sudo apt-get install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
elif test" $var" == "2" ;then
yum upgrade
yum install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
else
echo "Sorry these softwares can not be instaled in any other OS temporarily!"
exit
fi
done
echo "Congratulation ! Now you can use KeyNote now!"
exit 0
- xiooli
- 帖子: 6956
- 注册时间: 2007-11-19 21:51
- 来自: 成都
- 联系:
试试:
#!/bin/bash
echo "-------------------------------------------"
echo " | Wine & KeyNote Auto installer for Ubuntu & Fedora | "
echo "-------------------------------------------"
echo "What is your OS?"
echo "1)Linux
2)Fedora
3)Other"
read var
if [ $var==1 ];then
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
sudo wget http://wine.budgetdedicated.com/apt/sou ... hardy.list -O /etc/apt/sources.list.d/winehq.list
sudo wget http://wine.budgetdedicated.com/apt/sou ... /etch.list -O /etc/apt/sources.list.d/winehq.list
sudo apt-get upgrade
sudo apt-get install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
elif [ $var==2 ];then
yum upgrade
yum install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
else
echo "Sorry these softwares can not be instaled in any other OS temporarily!"
exit
fi
echo "Congratulation ! Now you can use KeyNote now!"
exit 0
#!/bin/bash
echo "-------------------------------------------"
echo " | Wine & KeyNote Auto installer for Ubuntu & Fedora | "
echo "-------------------------------------------"
echo "What is your OS?"
echo "1)Linux
2)Fedora
3)Other"
read var
if [ $var==1 ];then
wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
sudo wget http://wine.budgetdedicated.com/apt/sou ... hardy.list -O /etc/apt/sources.list.d/winehq.list
sudo wget http://wine.budgetdedicated.com/apt/sou ... /etch.list -O /etc/apt/sources.list.d/winehq.list
sudo apt-get upgrade
sudo apt-get install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
elif [ $var==2 ];then
yum upgrade
yum install wine
sudo wget http://www.tranglos.com/free/files/kntsetup.exe
wine kntsetup.exe
else
echo "Sorry these softwares can not be instaled in any other OS temporarily!"
exit
fi
echo "Congratulation ! Now you can use KeyNote now!"
exit 0