Disable if already logged in.
If I am opening a second terminal on to a machine I am usually in a hurry! I have created this as 00-setup-hush and so now it's only the first terminal that calls sysinfo etc.
#!/bin/bash echo "user1 user2" > /etc/update-motd.d/hushlogin who | cut -d ' ' -f 1 | sort | uniq >> /etc/update-motd.d/hushlogin
Obvs "user1" might end up in hushlogin twice but it's good enough for our purposes.
But the users will never be deleted from hushlogin file, unless manually deleted. Not a good thing.
Hushlogin is recreated every time it's run. It works. On some machines I have echo -n "" > /etc/update-motd.d/hushlogin if there's no users I need / want to exclude.
You’re right, I didn’t notice the only >.