编写了安装脚本

编写了configure.sh方便后期安装
This commit is contained in:
张壹 2018-03-19 00:15:23 -07:00
parent 667cfaf7a8
commit 4f506007dc
2 changed files with 28 additions and 2 deletions

30
configure.sh Normal file → Executable file
View File

@ -1,3 +1,29 @@
#!/bin/bash
#
# 获取文件夹地址
folderAddress=`pwd`
# 指定安装地址 若不存在则建立 同时将路径添加到环境变量中
objectAddress="/usr/local/sbin"
if [[ ! -d $objectAddress ]]; then
mkdir $objectAddress
export PATH=$PATH:$objectAddress
#找到所有gmt开始的脚本名称 存入数组
scriptName=( `ls gmt*` )
for element in ${scriptName[@]}; do
objectName=${element%.*}
printf "creating links for "$objectName"... "
ln -s ${folderAddress}/${element} ${objectAddress}/${objectName}
printf "done\n"
done
else
#找到所有gmt开始的脚本名称 存入数组
scriptName=( `ls gmt*` )
for element in ${scriptName[@]}; do
objectName=${element%.*}
#若链接不存在 则建立
if [[ ! -L ${objectAddress}/${objectName} ]]; then
printf "creating links for "$objectName"... "
ln -s ${folderAddress}/${element} ${objectAddress}/${objectName}
printf "done\n"
fi
done
fi