목록File (1)
Run The Bridge
expect를 사용하여 원격지 파일 가져오기
나는 /bin/bash만 많이 사용해서 expect라는 게 있다는 것도 얼마 전에 알았다. 오늘은 expect를 이용하여 원격지 파일을 가져오는 코드를 작성한다. 물론 그전에 원격지 서버에 어떤 파일이 어느 위치에 있는지는 알고 있어야 한다(ex: /root/2022-07-29.text.txt) 간단하게 짠거라 별 기능은 없다 ㅎㅎ... sftp를 이용해 파일을 가져오는 코드만 필요할 때 유용하게 사용했으면 좋겠다. #!/usr/bin/env expect set user [lindex $argv 0] set hostip [lindex $argv 1] set password [lindex $argv 2] spawn /usr/bin/sftp ${user}@${hostip} expect "${user}@${h..
Cloud/Linux
2022. 7. 29. 21:52