update configure.sh
update configure.sh
This commit is contained in:
parent
888feff508
commit
f49bf4e26f
@ -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.
|
||||
|
||||
|
24
configure.sh
24
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
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user