#!/bin/sh
check_user()
{
user=`who | cut -f1 -d ' '`
for name in $user
do
if [ $name = $1 ]
then
return 1
else
return 0
fi
done
}
while true
do
echo "input user name:\c"
read name
check_user $name
if [ $? -eq 1 ]
then
echo "user name is online"
else
echo "user name is offline"
fi
done
阅读(672) | 评论(0) | 转发(0) |