From 4f506007dc19fd04cf14512c835d05067f65923f Mon Sep 17 00:00:00 2001 From: yizhang Date: Mon, 19 Mar 2018 00:15:23 -0700 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99=E4=BA=86=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 编写了configure.sh方便后期安装 --- configure.sh | 30 +++++++++++++++++++++-- sph_global_dot.sh => gmtsph-global-dot.sh | 0 2 files changed, 28 insertions(+), 2 deletions(-) mode change 100644 => 100755 configure.sh rename sph_global_dot.sh => gmtsph-global-dot.sh (100%) diff --git a/configure.sh b/configure.sh old mode 100644 new mode 100755 index b2aa584..c85e974 --- a/configure.sh +++ b/configure.sh @@ -1,3 +1,29 @@ #!/bin/bash - -# \ No newline at end of file +# 获取文件夹地址 +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 \ No newline at end of file diff --git a/sph_global_dot.sh b/gmtsph-global-dot.sh similarity index 100% rename from sph_global_dot.sh rename to gmtsph-global-dot.sh