diff --git a/scripts/glpi-change.sh b/scripts/glpi-change.sh index cceff4d..43044a7 100755 --- a/scripts/glpi-change.sh +++ b/scripts/glpi-change.sh @@ -58,7 +58,7 @@ done set -a; . "$ENV_FILE"; set +a BASE="${GLPI_URL%/}" -[ -n "${GLPI_USER_TOKEN:-}" ] && [ -n "${GLPI_APP_TOKEN:-}" ] || die "tokens missing in $ENV_FILE" +if [ -z "${GLPI_USER_TOKEN:-}" ] || [ -z "${GLPI_APP_TOKEN:-}" ]; then die "tokens missing in $ENV_FILE"; fi sess_request() { curl -s -m 30 -H "Content-Type: application/json" \ @@ -131,7 +131,7 @@ create) ;; transition) cid="${args[0]:-}"; status="${args[1]:-}" - [ -n "$cid" ] && [ -n "$status" ] || die "usage: transition " + if [ -z "" ] || [ -z "" ]; then die "usage: transition "; fi body="$(mktemp)" jq -n --argjson s "$status" '{input: {status: $s}}' > "$body" resp="$(api PUT "Change/$cid" "$body")"