Sponsored Content
Top Forums Shell Programming and Scripting Calling Expect Script - Telnet Post 302548059 by trinak96 on Wednesday 17th of August 2011 10:41:04 AM
Old 08-17-2011
OK, first change didn't accomplish anything.
Second change, calling via /usr/bin/expect<expectscript> ipadd, with trace running outputs:
Code:
~/Scripts$ ./get-int
+ read ipadd
+ echo 10.33.220.12
10.33.220.12
+ export ipadd
+ /usr/bin/expect list-int 10.33.220.12
can't read "1": no such variable
    while executing
"set device $1"
    (file "list-int" line 6)

So changing the method of calling the script has stopped the argument being passed by the looks of it...

Last edited by vbe; 08-17-2011 at 12:41 PM.. Reason: code tags!!!!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling an Expect script from a Webpage using PHP

I have a webpage that is in HTML and PHP. In PHP I have tried using exec, system, shell_exec and passthru functions to call an Expect Script file (temp.exp). This Expect file spawns a telnet session that uses "expect/send" commands to retrieve information from an environmental unit (not a normal... (0 Replies)
Discussion started by: CCUSmith
0 Replies

2. Shell Programming and Scripting

Calling Expect script in Perl...

I call a EXPECT script from my perl script with machine IP and a FIle. The script logins to the machine and exports the value. The values to be exported or stored in a file. I have close to 10 machines and I have created 10 files and pass the corresponding files in command line, Now I could like... (4 Replies)
Discussion started by: ramkriz
4 Replies

3. Shell Programming and Scripting

Telnet Expect script question

Hi all, I have written a small expect script which should spawn a telnet session login and execute some commands. #!/usr/bin/expect -f spawn telnet $env(IP) match_max 100000 expect "login:" send -- "******\n" expect -exact "Password:" send -- "****\n" expect "%" Now I have got... (2 Replies)
Discussion started by: stinkefisch
2 Replies

4. Shell Programming and Scripting

calling expect script in ksh is failing via cron

I'm calling an expect script via a ksh script in cron and it is failing. The script runs fine if i run it manually. Does anyone know if it is an issue with compatibilty and if there is a way around it? (2 Replies)
Discussion started by: bhatia
2 Replies

5. Shell Programming and Scripting

ssh is not working while calling through expect shell script

Hi, Please share you experience and way out on below error:--> #!/bin/bash -xv FILE=login.txt + FILE=login.txt CONNECT=sshlogin.exp + CONNECT=sshlogin.exp SERVERNAME=$1 + SERVERNAME=192.168.12.1 MyServer="" + MyServer= MyUser="" + MyUser= MyPassword="" + MyPassword= exec 3<&0 +... (6 Replies)
Discussion started by: manish_1678
6 Replies

6. Shell Programming and Scripting

Calling Shell Script from Expect...

Hi there, I need some help regarding the execution of shell script from expect as the method I am trying is giving me error. I wrote an shell program which takes two arguments to telnet to a device and saves the output in a file. Following is the script.... (0 Replies)
Discussion started by: cyberparanoid
0 Replies

7. Shell Programming and Scripting

Calling a function which uses expect from a shells script

Hi all, This is the first time i am using expect. I am trying to call a function with in the shell script. The function will shh to a new server and will pass the password using expect and send. I need help in calling the fuction i am getting follaowing errors... here the script ... (8 Replies)
Discussion started by: firestar
8 Replies

8. Programming

Calling expect script inside another expect

Hi, Am very new to expect scripting.. Can You please suggest me how to call an expect script inside another expect script.. I tried with spawn /usr/bin/ksh send "expect main.exp\r" expect $root_prompt and spawn /usr/bin/ksh send "main.exp\r" expect $root_prompt Both... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies

9. Programming

Calling another expect script inside an expect script

I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues: set REMOTE "/root/scripts/remote" ... log_user 1 send_user "Executing remote script as $user...\n" send_user "Command to execute is: $REMOTE... (1 Reply)
Discussion started by: brettski
1 Replies

10. Shell Programming and Scripting

Password check in bash script calling on expect

password check in bash script calling on expect Background: I have to copy a file from one server, to over 100 servers in a test environment. once the file is copied, it requires to have the permissions on the file changed/verified. These are all linux servers. most of them have the same... (1 Reply)
Discussion started by: 2legit2quit
1 Replies
ypxfr(8yp)																ypxfr(8yp)

Name
       ypxfr - transfer a yellow pages (YP) map from a YP server to the local host.

Syntax
       ypxfr [ -f ] [ -h host ] [ -d domain ] [ -c ] [ -C tid prog ipadd port ] mapname

Description
       The  command moves a YP map, specified by the mapname argument, to the local host by making use of normal YP services.  It creates a tempo-
       rary map in the directory (which must already exist), fills it by enumerating the map's entries, obtains the  map  parameters  (master  and
       order  number) and loads them into the map.  Once has accomplished these tasks, it deletes any old versions of the map and moves the tempo-
       rary map to the real mapname.

       If is run interactively, it writes its output to the terminal.  However, if it is invoked without a controlling terminal, and  if  the  log
       file exists, it will append all its output to that file.  Since is most often run from or by the log file can be used to retain a record of
       what was attempted, and the results.

       For consistency between servers, should be run periodically for every map in the YP database.  Different maps change  at  different  rates:
       the  map  may  not  change for months at a time, for instance, and may therefore be checked only once a day. It is possible that or changes
       several times per day.  In such a case, it is appropriate to check hourly for updates.	A entry should be used to perform periodic updates
       automatically on YP server machines only.  Rather than having a separate entry for each map, commands can be grouped to update several maps
       in a shell script.  Examples (mnemonically named) are in and They can serve as reasonable first cuts.

       See and for an overview of the yellow pages.

Options
       -f	 Force the transfer to occur even if the version at the MASTER is not more recent than the local version.

       -c	 Do not send a "Clear current map" request to the local process.  This flag should be used if is not running locally at  the  time
		 when is running.  Otherwise, will report that it can not talk to the local and the transfer will fail.

       -h host	 Get  the map from host, regardless of which map is the master.  If host is not specified, will ask the YP service for the name of
		 the master, and try to get the map from there.  The host option can be a name or an internet address in the form a.b.c.d .

       -d domain Specify a domain other than the default domain.

       -C tid prog ipadd port
		 This option is only for use by When invokes it specifies that should call back a process at the host with IP address ipaddr, reg-
		 istered as program number prog, listening on port port, and waiting for a response to transaction tid.

Files
See Also
       ypfiles(5yp), cron(8), yppush(8yp), ypserv(8yp), ypsetup(8yp)

																	ypxfr(8yp)
All times are GMT -4. The time now is 11:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy