BBS水木清华站∶精华区
发信人: Linxs (红楼-学习工作创业-忙!!!), 信区: Linux
标 题: 一个有趣的脚本:Hello.sh
发信站: BBS 水木清华站 (Sat Oct 21 21:18:25 2000)
#!/bin/bash
# This script is writen by linxs
# You can run it when your machine start up
while [ : ] ; do
timenow=$( date | awk ' { print $2 $3 $4}'|awk -F: '{printf "%s:%s", $1, $2}')
oldwhonline=$(echo $whonline)
whonline=$( who | awk '{ print $3 $4 $5,$1,$2}' )
set $whonline
# echo "********************************************"
# echo "the who on line now is: $*"
# echo
# echo "the old who on line is: $oldwhonline"
# echo $timenow
while [ "$1" != "" ];do
# echo "compare $3 with $oldwhonline"
# echo $mylog "?" "$mywho"|awk -F? '{ print match($2,$1) }'
newlog=$(echo "$3""?""$oldwhonline" | awk -F? '{print match($2,$1)}' )
# echo "newlog" $newlog
if [ "$newlog" = 0 ]; then
#: echo "time is :$1 , name is $2, tty is $3 "
$(echo "Welcome,Linxs' Script say hello to You!" | write $2 $3 )
fi
shift;shift;shift
done
# sleep 1
done
exit 1
--
曾忆美人相伴, 红袖添香把盏;
年少无知纨绔, 只为生多蹊跷。
※ 来源:·BBS 水木清华站 smth.org·[FROM: 166.111.162.3]
BBS水木清华站∶精华区