Hello,
I've been debugging the following script all evening and am now stuck...this script is supposed to ssh to a router, pull interface conf, 'cut' 3 pieces of info, and then print the results of 2 as well as the 3rd (after running a ping cmd on the linux box):
SCRIPT_CODE
#! /bin/bash
lb1="0"
lb2="3";
device=core1.sjo1
while `env test "$lb1" -le "$lb2"`
do
`ssh orcadmin@$device "sh run int lo $lb1" ; "exit" > conf_info1`
echo "`cat conf_info1`"
`cat conf_info1 | grep Loopback > lb_int`
`cat conf_info1 | grep address > lb_addr`
`cat conf_info1 | grep description > lb_desc`
interface=`cut -f2 lb_int -d " "`
address=`cut -f3 lb_addr -d " "`
description=`cut --characters=14- lb_desc`
`echo $interface $address`
pinginfo=`ping "$address"`; printf "\n $pinginfo"
echo "$device $interface is reachable, as the following shows, $pinginfo"
lb1=`expr $lb1 + 1`
done
SCRIPT RUNNING:
[linux]$ sh dev*
orcadmin@core1.sjo1's password:
Connection to core1.sjo1 closed by remote host.
: command not found
ping: unknown host
core1.sjo1 is reachable, as the following shows,
--Any assistance/add'l_info would be greatly appreciated