#!/bin/bash # We mostly do not care about the return value in function local variable # assignments. So we can write the declaration and assignment in one line. die() { echo -e "$*" 1>&2 exit 1 } usage() { local file="$(basename "$0")" die "$file {-r|--rack}=" \ "{-s|--slot}=" \ "[{-b|--bay}=]" \ "[{-i|--interface=}]" \ "[--rack-height=]" } parse_mgmt() { local host="$1"; shift local dev="$(ipmitool lan print 1)" cat < 47 || slot < 1 )) && die "Error: Slot not in valid range!" # json_data curl -d "$(json_data)" -H "Content-Type: application/json" -X POST --insecure https://bas.intra.uni-freiburg.de/api/registration/clients