当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 6 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : [问题]如何写自动下载和安装软件的脚本?
帖子发表于 : 2008-04-29 1:30 

注册: 2008-02-24 10:09
帖子: 10
地址: Northern Ireland
送出感谢: 0 次
接收感谢: 0 次
本人想写一个在UBUNTU和FEDORA上面自动下载和安装WINE的脚本,由于刚学SHELL SCRIPT 什么都不懂,无重入手。。。希望各位高手给个例子让小弟从中学习学习。。 :)


页首
 用户资料  
 
2 楼 
 文章标题 :
帖子发表于 : 2008-04-29 1:37 
头像

注册: 2007-11-22 10:20
帖子: 3406
地址: 北京
送出感谢: 0 次
接收感谢: 1
好像有这样的帖子的说。


_________________
lenovo Thinkpad R60i 0657 LHC
windowsXP……准备换回ubuntu了。

Twitter: @carbont


页首
 用户资料  
 
3 楼 
 文章标题 :
帖子发表于 : 2008-04-29 21:22 

注册: 2008-02-24 10:09
帖子: 10
地址: Northern Ireland
送出感谢: 0 次
接收感谢: 0 次
硬着头皮写了这样一个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!"


页首
 用户资料  
 
4 楼 
 文章标题 :
帖子发表于 : 2008-04-29 21:44 

注册: 2007-04-09 12:19
帖子: 119
送出感谢: 0 次
接收感谢: 0 次
代码:
#! /bin/bash

ubuntu下的/bin/sh指向dash,而不是bash,两者语法虽然相差不远,但仍有些区别。

关于wine的自动安装,记得以前有个叫做easywine的脚本可以参考一下。


页首
 用户资料  
 
5 楼 
 文章标题 :
帖子发表于 : 2008-04-29 22:10 

注册: 2008-02-24 10:09
帖子: 10
地址: Northern Ireland
送出感谢: 0 次
接收感谢: 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


页首
 用户资料  
 
6 楼 
 文章标题 :
帖子发表于 : 2008-04-29 22:23 
头像

注册: 2007-11-19 21:51
帖子: 6956
地址: 成都
送出感谢: 0 次
接收感谢: 4
试试:
#!/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


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 6 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译