Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to display a message after who command 1

Status
Not open for further replies.

maxcrook

Programmer
Jan 25, 2001
210
GB
I need to run the who command in a script that will then display a message stating that there are more than 1 users on the system should the results of the who command return more than 1 users logged on.

I know the following does not work but am i on the right lines ? Anyone already run a similar script ?
num=`who`
if [ "$num" -gt "1" ]
then
print "MORE THAN ONE USER ON SYSTEM"
fi
 
if [[ $(who |wc -l) -gt 1 ]]
then
echo more than 2
fi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top