make sure input line is set before doing things

This commit is contained in:
burnettk 2024-05-07 20:43:15 -04:00
parent b64b21054e
commit 141a327627
No known key found for this signature in database
1 changed files with 10 additions and 5 deletions

View File

@ -7,7 +7,10 @@ function error_handler() {
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
script_dir="$(
cd -- "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)"
if [[ -z "${KEYCLOAK_BASE_URL:-}" ]]; then
export KEYCLOAK_BASE_URL=http://localhost:7002
@ -24,9 +27,11 @@ fi
export REALM_NAME=${2-spiffworkflow}
while read -r input_line; do
if ! grep -qE '(^#|email)' <<<"$input_line" ; then
username=$(awk -F '@' '{print $1}' <<<"$input_line")
password=$(awk -F ',' '{print $2}' <<<"$input_line")
"${script_dir}/login_with_user" "$username" "$password"
if [[ -n "$input_line" ]]; then
if ! grep -qE '(^#|email)' <<<"$input_line"; then
username=$(awk -F '@' '{print $1}' <<<"$input_line")
password=$(awk -F ',' '{print $2}' <<<"$input_line")
"${script_dir}/login_with_user" "$username" "$password"
fi
fi
done <"$user_list"