Created
May 23, 2021 00:03
-
-
Save ahmetozer/70f527fef38b10fb6738185da2af1165 to your computer and use it in GitHub Desktop.
Telnet send command without expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
pipe_loc="/tmp/telnet1" | |
if [ ! -p $pipe_loc ]; then | |
mkfifo $pipe_loc | |
fi | |
tail -f $pipe_loc | telnet 10.0.0.3 23 & | |
PID1=$! | |
sleep 1 | |
echo $'ls\n' >$pipe_loc | |
sleep 1 | |
echo $'exit\n' >$pipe_loc | |
sleep 1 | |
kill $PID1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment