菜鸟写了一个批量修改密码的SHELL脚本,在测试系统中运行OK,但到了正式环境就出问题了。:0wl;l1
请各位大侠慷慨解囊,助学妹一臂之力,感激不尽!!!(6)m:b
报错信息如下:
[……]# ./autochg.sh u.p
spawn passwd myp
Changing password for user myp.
./autochg.sh: line 7: 321 Segmentation fault ./expect.sh $USERNAME $PASSWORD
脚本如下:
1、创建用户/密码对文件 u.p
myp:1111
2、创建expect.sh脚本文件
#!/usr/bin/expect
set username [lindex $argv 0]
set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "*assword:"
send "$password\n"
expect "*assword:"
send "$password\n"
expect eof
exit
3、创建autochg.sh文件,在此文件中调用expect.sh
#!/bin/sh
for i in `cat $1`
do
USERNAME=${i%:*}
PASSWORD=${i#*:}
./expect.sh $USERNAME $PASSWORD
done
feifeihua 于 2008-05-30 17:29:02发表:
来人那
救命呀:0w223dc
feifeihua 于 2008-05-30 17:28:39发表:
这个问题很难吗:0wl;l1
求助!!
feifeihua 于 2008-05-21 08:53:05发表:
请教!