I'm a cisco guy, and I know linux very well, just not bash scripting. What I need is a script (disconnect.sh and connect.sh) that will telnet into a switch and disable a port given an arguement.
So if type disconnect room16, it will go into a text file (switches.conf) and look for the given argument and load the ip to telnet to, and the port to shutdown.
The layout of the text file should look something like this, maybe tab delineated.
Code:
#switches.conf
# Syntax is <Room> <IP> <Port to shutdown>
Room1 192.168.1.1 FastEthernet0/1
Room2 192.168.1.2 FastEthernet0/2
Room3 192.168.1.3 FastEthernet0/3
So that when I type ./disconnect Room3 it will telnet to 192.168.1.3 and shutdown FastEthernet0/3 on the switch.
Now I know I need to use the expect command once I invoke telnet, but I haven't even gotten the above to work.