-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
EXTRA=() # array to hold extra positional arguments | ||
while [[ $# -gt 0 ]] # number of arguments needs to be greater than 0 | ||
do | ||
key="$1" | ||
case $key in | ||
--username) | ||
USERNAME="$2" | ||
shift 2 # pass username and value | ||
;; | ||
--password) | ||
PASSWORD="$2" | ||
shift 2 # pass password and value | ||
;; | ||
--bot-token) | ||
BOT="$2" | ||
shift 2 # pass bot-token and value | ||
;; | ||
*) # unnecessary option | ||
EXTRA+=("$1") # save it in an array to allow completion of script | ||
shift # pass anything not specified, default: 1 | ||
;; | ||
esac | ||
done | ||
set -- "${EXTRA[@]}" # restore positional parameters to allow rest of script to run without the extra options | ||
echo "--username ${USERNAME} --password ${PASSWORD} --bot-token ${BOT} https://test.encodedcc.org/" |