classify-users: determine type of Athena accounts
[user/alex/software/my-snippets.git] / krbroot
diff --git a/krbroot b/krbroot
index 5f0515dc01a36f6a7a8f189e90e78cfdfd3972a5..e1d7f9d59382822e89504df1e0205cf97ec26744 100755 (executable)
--- a/krbroot
+++ b/krbroot
@@ -1,7 +1,10 @@
 #!/bin/sh
 
+set -euf
+
 usage="Usage: $0 [-i instance] [-p principal] [-a addrend] subcommand [args]"
 
+ATHENA_USER=${ATHENA_USER:-$USER}
 principal="$ATHENA_USER/root@ATHENA.MIT.EDU"
 addrend="root"
 while getopts "i:p:a:h" options; do
@@ -23,7 +26,7 @@ init () {
     kinit -F -5 -l15m "$principal" "$@"
 }
 
-case $1 in
+case ${1:-} in
     init)
         shift;
         exec kinit -F -5 -l15m "$principal" "$@"