打印

谁能帮我解释一下这个shell小程序

谁能帮我解释一下这个shell小程序

echo ' example for until '
echo ' the shell wait until another user whose login name we pass on the command line logs on'

until who | grep "$1" > /dev/null
do
    sleep 60
done

echo -e \\a

我telnet到一台计算机上,运行这个程序后就退出了,为什么?

TOP

怎么运行的?
执行这个脚本?
Homepage: http://www.zhyfly.org/
GNU/Linux: redhat(Fedora Core) -> Debian -> SlackWare

TOP

我telnet到一台机器上,然后在那台机器上运行“. aaa.sh”

TOP

" echo ' example for until '
echo ' the shell wait until another user whose login name we pass on the command line logs on' "

until 的例子
该脚本一直等到一个与传给脚本参数一样的用户名登录为止

你加参数了吗?

TOP

我没加参数,/dev/null 是什么意思

TOP

正确用法应该是 ./aaa.sh  xxx
xxx为一用户名,该用户登录时,该脚本退出
/dev/null 为一null设备, 就是 所有输入都被废弃掉.

TOP