shell脚本引用其他的脚本

 分类:Linux, Operating System 阅读 (918)  shell脚本引用其他的脚本已关闭评论
4月 202020
 

  有多个功能类似的脚本,用到同一个变量,但是这个变量有可能会根据需要改变,如果每个脚本文件定义一个这个变量,修改的时候每个脚本都要修改,很麻烦,所以想将这个变量定义在一个common.sh脚本里面,然后在功能脚本里面引用这个脚本,代码如下:

 

12月 032015
 

使用apt-get下载软件慢的话,可以换成国内的一些源,这样就可以节省很多时间了

修改方法:

1. 先备份系统的源文件,然后编辑源列表文件

cp /etc/apt/sources.list /etc/apt/sources.list.bak
vi /etc/apt/sources.list

在打开的编辑器中加入以下内容

deb http://mirrors.sohu.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.sohu.com/ubuntu/ precise-updates main restricted
deb http://mirrors.sohu.com/ubuntu/ precise universe
deb-src http://mirrors.sohu.com/ubuntu/ precise universe
deb http://mirrors.sohu.com/ubuntu/ precise-updates universe
deb-src http://mirrors.sohu.com/ubuntu/ precise-updates universe
deb http://mirrors.sohu.com/ubuntu/ precise multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-updates multiverse
deb http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse

网易源:

deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse

保存文件,再试试下面的命令

sudo apt-get update
sudo apt-get upgrade