Sponsored Content
Top Forums Shell Programming and Scripting Calling Shell Script from Expect... Post 302540115 by cyberparanoid on Tuesday 19th of July 2011 03:53:23 PM
Old 07-19-2011
Data 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.
===================================================

Code:
     #!/usr/bin/bash
     # Directory where the log files will be stored
     #
     DIR=/tmp/Vlan

     ########################################

     if [ ! -e $DIR ]
     then
       mkdir $DIR
     fi

     # Collect data from the router
     (echo "cic";\
     echo "cic123!";\
     echo "term len 0";\
     echo "show vlan  | e VLAN|enet|token|fddi|default|Vlan|vlan|-        0      0 |----|Type";\
     echo "q";\
     sleep 3)|telnet $1 > $DIR/$1.txt
	 awk '/active/ {print $1," ",$2}' $DIR/$1.txt > $DIR/$2.txt


=================================================


Now when I try to call it from expect script then the following error occurs. Please guide me how to resolve this issue.


Code:
spawn /tmp/infovlan.sh 192.168.111.28 PEAGG
/tmp/infovlan.sh: test: argument expected


If I try to execute it using the below method then the same error is produced.


Code:
exec /tmp/infovlan.sh 192.168.111.28 PEAGG
/tmp/infovlan.sh: test: argument expected


however the script runs fine if I run from cli directly.

Regards,

Last edited by pludi; 07-19-2011 at 06:58 PM..
 

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

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

4. 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

5. Shell Programming and Scripting

Calling Expect Script - Telnet

Hi All, I have an Expect script which logs into Cisco switch, performs a show interface command. I want to read a file of ip addresses which will be passed to the expect script. The script to read the file works, the expect script works on it's own but when i call the 'expect' script from the... (12 Replies)
Discussion started by: trinak96
12 Replies

6. 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

7. 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

8. 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

9. 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

10. UNIX for Advanced & Expert Users

Calling expect from shell script which inturn call python

Hi Team, I have to execute a task from my local machine, where i keep my .expect,.sh, .bash and .python scripts .Task are coded in the script and has to be executed at remote machine. for that i used following task ..... SCRIPT 1: cat shell_check.sh read value if then expect... (3 Replies)
Discussion started by: Sivarajan N
3 Replies
POLYORB-CONFIG(1)					       PolyORB documentation						 POLYORB-CONFIG(1)

NAME
polyorb-config - script to get information about the installed version of PolyORB. SYNOPSIS
polyorb-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version|-v] [--config] [--libs] [--cflags] [--idls] [--help] DESCRIPTION
polyorb-config is a tool that is used to determine the compiler and linker flags that should be used to compile and link programs that use PolyORB. OPTIONS
polyorb-config accepts the following options: --prefix[=DIR] Output the directory in which PolyORB architecture-independent files are installed, or set this directory to DIR. --exec-prefix[=DIR] Output the directory in which PolyORB architecture-dependent files are installed, or set this directory to DIR. --version|-v Print the currently installed version of PolyORB on the standard output. --config Print the configuration of the currently installed version of PolyORB on the standard output. --libs Print the linker flags that are necessary to link a PolyORB program. --cflags Print the compiler flags that are necessary to compile a PolyORB program. --idls Print the flags to set up path to CORBA's IDL for idlac. --with-appli-perso=P,P,P Restrict output to only those flags relevant to the listed applicative personalities. --with-proto-perso=P,P,P Restrict output to only those flags relevant to the listed protocol personalities. --with-corba-services=S,S,S Restrict output to only those flags relevant to the listed services. --help Print help message. AUTHORS
The PolyORB team, polyorb-devel@lists.adacore.com. SEE ALSO
The PolyORB WWW page, http://libre.adacore.com/polyorb/ PolyORB team April 26, 2007 POLYORB-CONFIG(1)
All times are GMT -4. The time now is 01:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy