Skip to content

Instantly share code, notes, and snippets.

@ahmetozer
Created May 23, 2021 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmetozer/70f527fef38b10fb6738185da2af1165 to your computer and use it in GitHub Desktop.
Save ahmetozer/70f527fef38b10fb6738185da2af1165 to your computer and use it in GitHub Desktop.
Telnet send command without expect
#!/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