Skip to content

Commit

Permalink
chirpotle.sh: Add error message if script parameter is not set or doe…
Browse files Browse the repository at this point in the history
…s not exist
  • Loading branch information
Hermann Leinweber committed Jan 18, 2024
1 parent 05de650 commit 87e3888
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chirpotle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ function chirpotle_run {

# Parameter parsing
while [[ $# -gt 0 ]] && [[ -z "$SCRIPTNAME" ]]; do
# -z is required to stop after 'scriptname' was parsed. Further arguments are passed to the script.
KEY="$1"
case "$KEY" in
-c|--conf)
Expand Down Expand Up @@ -916,6 +917,10 @@ function chirpotle_run {
esac
done
# ... all other arguments (if any) are passed to the script as positional args
if [[ ! -e "$SCRIPTNAME" ]]; then
echo "Abort: Script could not be found. (The parsed script name was: '$SCRIPTNAME')"
exit -1
fi
while [[ $# -gt 0 ]]; do
POSITIONAL+=("$1")
shift
Expand Down

0 comments on commit 87e3888

Please sign in to comment.