Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 2001 12:54:46 -0600
From:      jsconiers@focal.com
To:        freebsd-questions@freebsd.org
Subject:   shell scripting question
Message-ID:  <OFD085ED7E.2DAAF8EB-ON862569DC.0067AAC9@focal.com>

next in thread | raw e-mail | index | archive | help
Quick question.  I currently am writting a script that will login to a
router and perform a command.  I am accepting variables and process
them like this.

$./getconfig -i 10.1.1.8 -u oper -p LooT -t cisco -e enabler.
(i for ip address, u for username, p password, t device type and e the
enable password)

Then "getconfig" would accept the entry and process accordingly.  SO far
I'm stuck witht this:

#! /usr/local/bin/bash
#
#script defaults
# usage param
usage="Usage: getme -i <ip> -u <user> -p <password> -t <type> -e
enable......"
while getopts ":i:u:p:t:e:" opt; do
        case $opt in
          i  ) ip=$OPTARG ;;
          u  ) user=$OPTARG ;;
          p  ) password=$OPTARG ;;
          t  ) type=$OPTARG ;;
          e  ) enable=$OPTARG ;;
          \? ) echo $usage
                exit 1 ;;
        esac
done
shift $(($OPTIND - 1))
# pass on to expect.

The problem is that I want to use this information to expect into a
router and perform the needed commands.  How would I invoke expect
(silently) within the shell script to spawn an ssh session??

JRS



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OFD085ED7E.2DAAF8EB-ON862569DC.0067AAC9>