Thursday, May 3, 2007

Simulating router "show" command


This is very important while one configure snmp simulator "mimic" for telnet.

Here is one script to simulate "show" command, important, simple though.

#!/bin/sh
#show

count=0
FILE=./telnet/

for arg in $*
do
count=`expr $count + 1`
if [ $count -lt $# ]
then
FILE="$FILE"$arg"_"
else
FILE="$FILE"$arg
fi
done
cat $FILE.txt


A Sample run:

$ ./show ospf neighbor
cat: ./telnet/ospf_neighbor.txt: No such file or directory

So actual "show ospf neighbor" output is to be kept in the file ./telnet/ospf_neighbor.txt.

No comments:

© Jadu Saikia www.UNIXCL.com