diff --git a/README.md b/README.md index 5b9cc8b..adf6cf9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# gmt_template -shell scripts of GMT templates +# shell templates +shell script templates for geophysical data processing and plotting. ## Installation -Simply run **configure.sh** to symlink all scripts under the directory */usr/local/sbin*. The configure script will create the folder and add it to *PATH* if the directory does not exist. The execuable name for a script will be its name without the *.sh* extension. +Simply run **configure.sh** to symlink all scripts to the directory */usr/local/sbin*. The configure script will create the folder and add it to *PATH* if the directory does not exist. The execuable name for a script will be its name without the *.sh* extension. diff --git a/configure.sh b/configure.sh index c85e974..a8911c7 100755 --- a/configure.sh +++ b/configure.sh @@ -1,23 +1,17 @@ #!/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 +fi +#找到所有后缀名为.sh的脚本名称 存入数组 +scriptName=( `ls *.sh` ) +for element in ${scriptName[@]}; do + #排除configure.sh + if [[ $element != "configure.sh" ]]; then objectName=${element%.*} #若链接不存在 则建立 if [[ ! -L ${objectAddress}/${objectName} ]]; then @@ -25,5 +19,5 @@ else ln -s ${folderAddress}/${element} ${objectAddress}/${objectName} printf "done\n" fi - done -fi \ No newline at end of file + fi +done \ No newline at end of file