Skip to content

Instantly share code, notes, and snippets.

@javikalsan
Created March 26, 2014 15:59
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save javikalsan/9786684 to your computer and use it in GitHub Desktop.
Save javikalsan/9786684 to your computer and use it in GitHub Desktop.
Simple Bash Script to execute a command on the router through telnet command
#!/bin/sh
# replace cmd1 for the command to execute
host=192.168.1.1
port=23
user=myuser
pass=mypass
cmd1='ifconfig wl0 down'
( echo open ${host}
sleep 1
echo ${user}
sleep 1
echo ${pass}
sleep 1
echo ${cmd1}
sleep 2
) | telnet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment