Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 2001 12:01:50 -0600 (CST)
From:      "jrs@enteract.com" <jrs@enteract.com>
To:        freebsd-questions@freebsd.org
Subject:   newbie bash scripting
Message-ID:  <Pine.BSF.4.21.0101221148350.28421-100000@shell-1.enteract.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 want to accept variables and process
them.  I want it do something 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 but how would I invoke expect
(silently) within the shell script.

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?Pine.BSF.4.21.0101221148350.28421-100000>