Chinaunix

标题: 帮忙解释一个脚本 [打印本页]

作者: city_85    时间: 2008-04-01 09:21
标题: 帮忙解释一个脚本
root# more /usr/bin/autopasswd
#!/bin/sh
# \
exec expect -f "$0" ${1+"$@"}
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd

set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "assword:"
send "$password\r"
expect "assword:"
send "$password\r"
expect eof

谁能够帮忙解释这个脚本的意思,谢谢




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2