This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
telnet [2019/12/22 09:50] dblume created |
telnet [2021/05/21 00:04] (current) |
||
---|---|---|---|
Line 24: | Line 24: | ||
===== Transfer a file by issuing a Remote Telnet Command ===== | ===== Transfer a file by issuing a Remote Telnet Command ===== | ||
+ | |||
+ | Netcat (nc) send the file locally, and nc receive the file at the remote device. | ||
<code bash> | <code bash> | ||
Line 38: | Line 40: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== Branching in Expect on whether a remote file exists ===== | ||
+ | |||
+ | <code expect> | ||
+ | send "ls --color=never $FNAME\r" | ||
+ | expect { | ||
+ | -re " | ||
+ | expect ":/ #" | ||
+ | send "stat $FNAME\r" | ||
+ | expect ":/ #" | ||
+ | send "echo $FNAME was already there.\r" | ||
+ | } | ||
+ | " | ||
+ | expect ":/ #" | ||
+ | send "ls ~\r" | ||
+ | expect ":/ #" | ||
+ | send "echo $FNAME was not there.\r" | ||
+ | } | ||
+ | } | ||
+ | expect ":/ #" | ||
+ | </ | ||
+ | |||
+ | Keywords: telnet, linux, nc, netcat |