0
의 순서로 스크립트를 기대할 호출 할 수있는 방법 : 나는 ./script.sh cmds_ cc1
같이 호출나는 내가처럼 보이는 기대 스크립트 한 인수
#!/usr/bin/expect
set path_start [lindex $argv 0]
set host [lindex $argv 1]
spawn ssh [email protected]$host telnet jpaxdp
expect {\-> }
set fh [open ${path_start}${host} r]
while {[gets $fh line] != -1} {
send "$line\r"
expect {\-> }
}
close $fh
send "exit\r"
expect eof
하고는, 지금 내 호스트가 1 번호가 - 8 난에 시도 ./script cmds_ cc[1-8]
같은 스크립트를 호출하지만 스크립트 인수로 호스트 [1-8] 해석 날을 가리 켰을 때, 그 작동하지 않았다 :
spawn ssh [email protected][1-8] telnet jpaxdp
ssh: Could not resolve hostname cc[1-8]: Name or service not known
couldn't open "cmds_cc[1-8]": no such file or directory
while executing
"open ${path_start}${host} r"
invoked from within
"set fh [open ${path_start}${host} r]"
(file "./script.sh" line 7)
가 어떻게이 일을 할 수 있습니까?
이것은 Expect 스크립트이며 bash 스크립트는 아닙니다. – Barmar
이와 같은 호출을 반복적으로 수행하는 명령 줄 유틸리티가있을 수 있습니다. 나는 빠른 인터넷 검색이 리눅스에서 당신을 찾지 못한다면 그렇게하는 또 다른 스크립트를 추천 할 것이다. – BrandonM