added root check function

master
Mateusz Chochół 7 years ago
parent c6ba6eb8c2
commit 68fc5098fb
  1. 8
      bmotd.sh

@ -7,7 +7,12 @@
MOTD="/etc/motd" MOTD="/etc/motd"
INSTPATH="/etc/bmotd.sh" INSTPATH="/etc/bmotd.sh"
# Check if root
main () { main () {
isRoot && echo 'You are root' || echo 'You are NOT root'
# Gather information # Gather information
HOSTNAME=$(hostname -s) HOSTNAME=$(hostname -s)
FQDN=$(hostname -f) FQDN=$(hostname -f)
@ -206,6 +211,9 @@ function parse_ifconfig() {
done; done;
} }
function isRoot() {
! (( ${EUID:-0} || $(id -u) ))
}
motdGen() { motdGen() {
# The different colours as variables # The different colours as variables

Loading…
Cancel
Save