summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2019-04-21 19:56:10 +0200
committerJonas Smedegaard <dr@jones.dk>2019-04-21 19:56:10 +0200
commit598d5307bbe5cf20f45780cd8ef1fb40c9694fe9 (patch)
treed8de55ac1b0fbac8849e967c045eea65ffc81a8f
parent3d6fb20968457c7a343df4fd1bd17b87a2449475 (diff)
Add boilerplate. Quote variable to please shellcheck.HEADmaster
-rwxr-xr-xlocalrmstaleaccounts8
1 files changed, 7 insertions, 1 deletions
diff --git a/localrmstaleaccounts b/localrmstaleaccounts
index dbb92f0..c7ceaae 100755
--- a/localrmstaleaccounts
+++ b/localrmstaleaccounts
@@ -1,4 +1,10 @@
#!/bin/sh
+#
+# /usr/local/sbin/localrmstaleaccounts
+# Copyright 2012, 2014, 2019 Jonas Smedegaard <dr@jones.dk>
+#
+# Remove unused user accounts
+#
set -e
@@ -50,7 +56,7 @@ remove_account() {
[ -n "$DRY_RUN" ] || localrmaccount "$1"
}
-for user in $@; do
+for user in "$@"; do
home=$(getent passwd "$user" | cut -d: -f6)
if [ -z "$home" ]; then
warn "Skipping user $user: failed resolving homedir"