CnUnix

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ CnUnix ] in KIDS
글 쓴 이(By): wang (Chip쟁이)
날 짜 (Date): 2004년 3월 18일 목요일 오후 06시 07분 22초
제 목(Title): Re: [Q] passwd 자동 입력 스크립트 작성 ?



perl/expect로 키즈 들어오는 예제입니다.

interact가 좀 이상하게 동작해서 마지막 'y'를 쳐주는 부분이

잘안되지만 password는 확실히 넣어줍니다.

#!/usr/local/bin/perl -w

use Expect;


$telnet = Expect->spawn("telnet kids.kornet.net");

$telnet->expect(30,"login: ") || die "Never got the login command\n";
print $telnet "kids\r";
$telnet->expect(30,"(User  Id): ") || die "Never got the userID command\n";
print $telnet "MyID\r";
$telnet->expect(30,"(Password): ") || die "Never got the password command\n";
print $telnet 'MyPassword';
print $telnet "\r";

$telnet->interact(\*STDOUT,"## 마치려면  \'y\' 를 입력하세요 \!");
print $telnet "y";
$telnet->hard_close();


[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.