Skip to content

Commit

Permalink
check cl arguments, #21
Browse files Browse the repository at this point in the history
  • Loading branch information
demanast@triangle committed Oct 19, 2017
1 parent 5e976ae commit bd232d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Many parameters configured at `default-param` file.

* `-mt "map title"`: Custom map title.

* `-ctext <path to file>` : Plot Custom text. Config custom text file.

* `-h`: Help menu

* `-debug`:Enable Debug option
Expand Down
40 changes: 27 additions & 13 deletions coulomb2gmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,26 @@ then
shift
;;
-cmt)
DEBUG echo "[DEBUG] cmt: next argument:" ${4}
if [ $# -gt 3 ] && [ -f ${4} ];
then
CMT=1
inpcmt=${4}
DEBUG echo "cmt file is: $inpcmt"
shift
shift
# elif [ $# -gt 4 ] && [ ! -f ${4} ];
# then
# echo "[WARNING] CMT file does not exist!CMT will not plot"
# shift
# shift
elif [ $# -gt 3 ] && [ ${4:0:1} == \- ];
then
echo "[WARNING] CMT file does not set! CMT will not plot"
shift
elif [ $# -gt 3 ] && [ ! -f ${4} ];
then
echo "[WARNING] CMT file does not exist! CMT will not plot"
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 plot"
shift
fi
;;
Expand All @@ -255,21 +260,26 @@ then
shift
;;
-ctext)
DEBUG echo "[DEBUG] ctext: next argument:" ${4}
if [ $# -gt 3 ] && [ -f ${4} ];
then
CTEXT=1
pth2ctextfile=${4}
DEBUG echo "custom text file is: $pth2ctextfile"
shift
shift
# elif [ $# -gt 3 ] && [ ! -f ${4} ];
# then
# echo "[WARNING] Text file does not exist!"
# shift
# shift
elif [ $# -gt 3 ] && [ ${4:0:1} == \- ];
then
echo "[WARNING] Custom text file does not set! Custom text will not plot"
shift
elif [ $# -gt 3 ] && [ ! -f ${4} ];
then
echo "[WARNING] Custom text file does not exist! Custom text will not plot"
shift
shift
elif [ $# -eq 3 ];
then
echo "[WARNING] Text file does not exist!"
echo "[WARNING] Custom text file does not set! Custom text will not plot"
shift
fi
;;
Expand Down Expand Up @@ -369,9 +379,13 @@ then
OUTPDF=1
shift
;;
-h)
-h)
help
;;
*)
echo "[ERROR] Bad argument structure. Script Finished Unsuccesful!"
echo "[ERROR] Exit Status 1"
exit 1
esac
done
else
Expand Down

0 comments on commit bd232d7

Please sign in to comment.