don't duplicate lines

This commit is contained in:
Daniel Jakots 2016-12-08 16:49:41 +01:00
parent eaa2c6b2a3
commit 869b03b018

View file

@ -18,16 +18,14 @@ PATH=$PATH:/usr/sbin
SENDMAIL=$(which sendmail)
# get ipaddress
BEGIN_YEAR=$(date "+%Y")
if [ $SYSTEME = "Linux" ]; then
IP=$(LC_ALL=C who | grep $(ps -o tty= | tail -1) | tr -s ' ' | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
# get begin_date
BEGIN_YEAR=$(date "+%Y")
BEGIN_DATE=$(LC_ALL=C who | grep $(ps -o tty= | tail -1) | tr -s ' ' | cut -d" " -f3,4,5)
_USER=$SUDO_USER
elif [ $SYSTEME = "OpenBSD" ]; then
IP=$(LC_ALL=C who | grep $(env | grep SSH_TTY | cut -d"/" -f3) | tr -s ' ' | cut -d" " -f6 | sed -e "s/^(// ; s/)$//")
# get begin_date
BEGIN_YEAR=$(date "+%Y")
BEGIN_DATE=$(LC_ALL=C who | grep $(env | grep SSH_TTY | cut -d"/" -f3) | tr -s ' ' | cut -d" " -f3,4,5)
_USER=$USER
else