Skip to content

Instantly share code, notes, and snippets.

@sixtyfive
Created November 14, 2018 17:43
Show Gist options
  • Save sixtyfive/a9016fc39c0b3518308d15150b9dcdeb to your computer and use it in GitHub Desktop.
Save sixtyfive/a9016fc39c0b3518308d15150b9dcdeb to your computer and use it in GitHub Desktop.
#!/bin/sh
cut -d':' -f'1,6' /etc/passwd | while IFS=: read username userhome; do
rcfile="$userhome/.rc"
if case $rcfile in "/home"*) true;; *) false;; esac; then
if test -x "$rcfile"; then
su -c "$rcfile" "$username"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment