From d4b15a47d1cc0fdb95339ef30dadb008eaf9afbd Mon Sep 17 00:00:00 2001 From: pi Date: Mon, 2 Sep 2019 14:22:25 +0800 Subject: [PATCH] Update gmtxy-dot.sh add -q option --- gmtxy-dot.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gmtxy-dot.sh b/gmtxy-dot.sh index 994c426..d7d4c2b 100755 --- a/gmtxy-dot.sh +++ b/gmtxy-dot.sh @@ -10,9 +10,10 @@ overwriteRange='null' overwrite=0 labels=("x (m)" "y (m)") valuerange="0/1000/10" +noshow=0 # 从命令行获取参数 -while getopts "hi:r:u:c:a:d:" arg +while getopts "hqi:r:u:c:a:d:" arg do case $arg in h) @@ -25,6 +26,7 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z printf "%s\t%s\n" "-u" "data unit. The default is meter." printf "%s\t%s\n" "-c" "color cpt. The default is rainbow." printf "%s\t%s\n" "-a" "axis labels. The deafults are x (m) and y (m)." + printf "%s\t%s\n" "-q" "do not show the output figure." exit 0;; i) data=$OPTARG;; @@ -39,6 +41,8 @@ For futher explanations, please look for GMT's manuscripts.\nAuthor: Yi Zhang (z labels=(${OPTARG//,/ });; d) valuerange=$OPTARG;; + q) + noshow=1;; ?) printf "error: unknow argument\nuse -h option to see help information\n" exit 1;; @@ -80,5 +84,7 @@ else # 在终端显示图像 此命令需要imgcat.sh脚本和iTerm终端 #imgcat $jpgfile # 打开图片文件 此命令使用MacOS终端open命令 - open $jpgfile + if [[ ${noshow} == 0 ]]; then + open $jpgfile + fi fi \ No newline at end of file