update configure.sh
update configure.sh
This commit is contained in:
parent
888feff508
commit
f49bf4e26f
@ -1,7 +1,7 @@
|
|||||||
# gmt_template
|
# shell templates
|
||||||
shell scripts of GMT templates
|
shell script templates for geophysical data processing and plotting.
|
||||||
|
|
||||||
## Installation
|
## 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.
|
||||||
|
|
||||||
|
20
configure.sh
20
configure.sh
@ -1,23 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# 获取文件夹地址
|
# 获取当前文件夹地址
|
||||||
folderAddress=`pwd`
|
folderAddress=`pwd`
|
||||||
# 指定安装地址 若不存在则建立 同时将路径添加到环境变量中
|
# 指定安装地址 若不存在则建立 同时将路径添加到环境变量中
|
||||||
objectAddress="/usr/local/sbin"
|
objectAddress="/usr/local/sbin"
|
||||||
if [[ ! -d $objectAddress ]]; then
|
if [[ ! -d $objectAddress ]]; then
|
||||||
mkdir $objectAddress
|
mkdir $objectAddress
|
||||||
export PATH=$PATH:$objectAddress
|
export PATH=$PATH:$objectAddress
|
||||||
#找到所有gmt开始的脚本名称 存入数组
|
fi
|
||||||
scriptName=( `ls gmt*` )
|
#找到所有后缀名为.sh的脚本名称 存入数组
|
||||||
for element in ${scriptName[@]}; do
|
scriptName=( `ls *.sh` )
|
||||||
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
|
for element in ${scriptName[@]}; do
|
||||||
|
#排除configure.sh
|
||||||
|
if [[ $element != "configure.sh" ]]; then
|
||||||
objectName=${element%.*}
|
objectName=${element%.*}
|
||||||
#若链接不存在 则建立
|
#若链接不存在 则建立
|
||||||
if [[ ! -L ${objectAddress}/${objectName} ]]; then
|
if [[ ! -L ${objectAddress}/${objectName} ]]; then
|
||||||
@ -25,5 +19,5 @@ else
|
|||||||
ln -s ${folderAddress}/${element} ${objectAddress}/${objectName}
|
ln -s ${folderAddress}/${element} ${objectAddress}/${objectName}
|
||||||
printf "done\n"
|
printf "done\n"
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user