HI
I written the script to check the currently logged in user. When i am executing this script i am getting an error like below
Error while running the script
HI
I written the script to check the currently logged in user. When i am executing this script i am getting an error like below
Error while running the script
#!/bin/bash
clear
echo "-----------------------------------"
a=`who | wc -l`
if [ "$a" -gt 10 ]; then
echo "Number of logged in users are more"
else
echo "Number of logged in users are less"
fi
echo "-----------------------------------"
You can use this too to make it more fancy:
#!/bin/bash
clear
echo "----------------------------------------------"
a=`who | wc -l`
max=10
if [ "$a" -gt "$max" ]; then
echo "Number of logged in users are more than $max"
echo "Online users: `users`"
else
echo "Number of logged in users are less than $max"
echo "Online users: `users`"
fi
echo "----------------------------------------------"