Breaking News
You are here: Home / Program Code / UNIX / write a script to accept a username & report whether the user is currently login or not.

write a script to accept a username & report whether the user is currently login or not.

$vi log.sh 
clear
echo -e "\n Enter username :\c"
read uname

v=`who | cut -d" " -f 1`

for i in $v
do
        if [ $i = $uname ]
        then
              echo -e "\n $uname is currently login "
              exit
        fi

done

       echo -e "\n $uname is not currently login "

:wq

Download Paper Solutions from Below Link

About admin

Scroll To Top