Tuesday, 20 January 2015

SHELL SCRIPT TO GREET YOU AS YOU LOG IN INTO THE SYSTEM :P


temph=`date | cut -c12-13`  //grep command could also be used
dat=`date +"%A %d in %B of %Y (%r)"`

if [ $temph -lt 12 ]
then
    mess="Good Morning $LOGNAME, Have nice day!"
fi

if [ $temph -gt 12 -a $temph -le 16 ]
then
    mess="Good Afternoon $LOGNAME"
fi

if [ $temph -gt 16 -a $temph -le 18 ]
then
    mess="Good Evening $LOGNAME"
fi

if which dialog > /dev/null                 //Parent Diectory
then
    dialog --backtitle "Linux"\
    --title "(-: Welcome to Linux :-)"\
    --infobox "\n$mess\nThis is $dat" 6 60
    echo -n "Press a key to continue. . ."
    read
    clear
else
    echo -e "$mess\nThis is $dat"
fi

No comments:

Post a Comment