首页 > 代码库 > 可以借鉴的脚本函数
可以借鉴的脚本函数
输出颜色
Color_Text(){echo -e " \e[0;$2m$1\e[0m"}Echo_Red(){echo $(Color_Text "$1" "31")}Echo_Green(){echo $(Color_Text "$1" "32")}Echo_Yellow(){echo $(Color_Text "$1" "33")}Echo_Blue(){echo $(Color_Text "$1" "34")}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stty命令,调用
Press_Install(){echo ""Echo_Green "Press any key to install...or Press Ctrl+c to cancel"OLDCONFIG=`stty -g`stty -icanon -echo min 1 time 0dd count=1 2>/dev/nullstty ${OLDCONFIG}. include/version.shKill_PM}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
从网上下载资源
Download_Mirror=‘http://soft.vpser.net‘Autoconf_Ver=‘autoconf-2.13‘Download_Files ${Download_Mirror}/lib/autoconf/${Autoconf_Ver}.tar.gz ${Autoconf_Ver}.tar.gzDownload_Files(){local URL=$1local FileName=$2if [ -s "${FileName}" ]; thenecho "${FileName} [found]"elseecho "Notice: ${FileName} not found!!!download now..." #-c, --continue 接着下载没下载完的文件#--progress=TYPE 设定进程条标记wget -c --progress=bar:force ${URL}fi}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
解压缩并且进入目录
Tar_Cd(){local FileName=$1local DirName=$2cd ${cur_dir}/src[[ -d "${DirName}" ]] && rm -rf ${DirName}echo "Uncompress ${FileName}..."tar zxf ${FileName}echo "cd ${DirName}..."cd ${DirName}}
可以借鉴的脚本函数
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。