예제 3

[UNIX/LINUX] 자동화를 위한 interactive 스크립트 - expect (2) 예제

이번 글에서는 expect 스크립트에 대한 예제를 통해 이해를 돕는 시간을 갖도록 하겠습니다. (2) 예제 #!/bin/expect set target "[lindex $argv 0]" set rootid "[lindex $argv 1]" set oldpwd "[lindex $argv 2]" set newpwd "[lindex $argv 3]" spawn telnet $target expect -timeout 5 "*ogin:" send "$rootid\n" expect -timeout 5 "*assword:" send "$oldpwd\n" sleep 2 expect -timeout 5 "#|>" send "passwd\n" expect -timeout 5 "New password:" send "$new..

[UNIX/LINUX] Shell Script 기본 - 3.for문 (2) 예제

#!/bin/shif [ -d $1 ]; then cd $1 if [ -f $2 -a -s $2 ]; then echo $2' is file and has contents more than one character.' array=`cat $1/$2` for day in ${array}; do if [ -n ${day} ]; then if [ ${day} == "Fri" -o ${day} == "Sat" ]; then echo ${day}' is very happy day!!' else echo ${day}' is gloomy day.' fi fi done else echo $2' is not file or has zero character.' fifi 앞서 if문 예제 글에서 보여 드렸던 예제 스크립트보..