Skip to content

Commit

Permalink
check aded for -o -mt options, #21
Browse files Browse the repository at this point in the history
  • Loading branch information
demanast@triangle committed Oct 19, 2017
1 parent bd232d7 commit 1159faa
Showing 1 changed file with 41 additions and 17 deletions.
58 changes: 41 additions & 17 deletions coulomb2gmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,22 @@ then
shift
;;
-o)
OUTFILES=1
outfile=${4}.ps
shift
shift
DEBUG echo "[DEBUG:${LINENO}] -o: next argument:" ${4}
if [ $# -gt 3 ] && [ ${4:0:1} != \- ];
then
OUTFILES=1
outfile=${4}.ps
shift
shift
elif [ $# -gt 3 ] && [ ${4:0:1} == \- ];
then
echo "[WARNING] Not output file name set"
shift
elif [ $# -eq 3 ];
then
echo "[WARNING] Not output file name set"
shift
fi
;;
-logogmt)
LOGOGMT=1
Expand All @@ -226,7 +238,7 @@ then
shift
;;
-cmt)
DEBUG echo "[DEBUG] cmt: next argument:" ${4}
DEBUG echo "[DEBUG:${LINENO}] cmt: next argument:" ${4}
if [ $# -gt 3 ] && [ -f ${4} ];
then
CMT=1
Expand All @@ -236,16 +248,16 @@ then
shift
elif [ $# -gt 3 ] && [ ${4:0:1} == \- ];
then
echo "[WARNING] CMT file does not set! CMT will not plot"
echo "[WARNING] CMT file does not set! CMT will not be plotted"
shift
elif [ $# -gt 3 ] && [ ! -f ${4} ];
then
echo "[WARNING] CMT file does not exist! CMT will not plot"
echo "[WARNING] CMT file does not exist! CMT will not be plotted"
shift
shift
elif [ $# -eq 3 ];
then
echo "[WARNING] CMT file does not exist! CMT will not plot"
echo "[WARNING] CMT file does not exist! CMT will not be plotted"
shift
fi
;;
Expand All @@ -254,13 +266,25 @@ then
shift
;;
-mt)
MTITLE=1
mtitle=$4
shift
shift
DEBUG echo "[DEBUG:${LINENO}] maptitle: next argument:" ${4}
if [ $# -gt 3 ] && [ ${4:0:1} != \- ];
then
MTITLE=1
mtitle=$4
shift
shift
elif [ $# -gt 3 ] && [ ${4:0:1} == \- ];
then
echo "[WARNING] No map title defined. Default title will be printed"
shift
elif [ $# -eq 3 ];
then
echo "[WARNING] No map title defined. Default title will be printed"
shift
fi
;;
-ctext)
DEBUG echo "[DEBUG] ctext: next argument:" ${4}
DEBUG echo "[DEBUG:${LINENO}] ctext: next argument:" ${4}
if [ $# -gt 3 ] && [ -f ${4} ];
then
CTEXT=1
Expand All @@ -270,16 +294,16 @@ then
shift
elif [ $# -gt 3 ] && [ ${4:0:1} == \- ];
then
echo "[WARNING] Custom text file does not set! Custom text will not plot"
echo "[WARNING] Custom text file does not set! Custom text will not be plotted"
shift
elif [ $# -gt 3 ] && [ ! -f ${4} ];
then
echo "[WARNING] Custom text file does not exist! Custom text will not plot"
echo "[WARNING] Custom text file does not exist! Custom text will not be plotted"
shift
shift
elif [ $# -eq 3 ];
then
echo "[WARNING] Custom text file does not set! Custom text will not plot"
echo "[WARNING] Custom text file does not set! Custom text will not be plotted"
shift
fi
;;
Expand Down Expand Up @@ -382,7 +406,7 @@ then
-h)
help
;;
*)
-*)
echo "[ERROR] Bad argument structure. Script Finished Unsuccesful!"
echo "[ERROR] Exit Status 1"
exit 1
Expand Down

0 comments on commit 1159faa

Please sign in to comment.