Using Expect results in a Shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using Expect results in a Shell script
# 1  
Old 10-16-2008
Using Expect results in a Shell script

I am trying to write a shell script that launches an expect script and then use results of the expect script in the rest of the shell script.

The expect script is connecting to a remote host and looking up certian user info like UID and home directory. This part is working

I then want the shell script to use these results in test statement (if uid xxx exists the scp these files to their home)

How do I export the the results of the expect script to the shell script?

My TCL experiance is limited to getting the basic expect script working.
# 2  
Old 10-17-2008
You should be able to simply redirect the output of the expect script to a file and then process that as you normally would?
# 3  
Old 10-17-2008
It isn't as graceful as I was hoping but I think I can make that work.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Emailing results of a pl sql procedure from UNIX shell script

Hello All, I am writing the below unix script to email the result of a small pl sql procedure: #!/bin/bash ORACLE_HOME=/opt/oracle/orcts/product/9.2.0; export ORACLE_HOME SQLPLUS=$ORACLE_HOME/bin/sqlplus sqlplus -s user/pass@Db_instance<<EOF set echo off set feedback off set pages 0... (9 Replies)
Discussion started by: Bunty bedi
9 Replies

2. Shell Programming and Scripting

How to use expect in shell script?

Dear friends, Could you please help me in writing a sample code to connect the remote system (through ssh) using expect in shell script. Thanks in advance.. :-) (1 Reply)
Discussion started by: rajesh.tulluri
1 Replies

3. Shell Programming and Scripting

Help with Expect in Shell Script

Hi All, I have a expect script which is working for single server, but if i am trying to pass value of the variable inside expect, it is not working. Please see below :- expect -c 'spawn ssh username@ip_address ; expect assword ; send "Password1\n" ; send "uptime \n" ; send "free -m \n" ;... (0 Replies)
Discussion started by: Renjesh
0 Replies

4. Programming

Expect script to run a Shell script on remote server

Hi All, I am using a expect script to run a shell script on remote server, the code is as follows. But the problem is that it executes only first command, and hangs it doesn't run the next commands. spawn ssh $uid@$host expect "password:" send "$password\r" expect "*\r" send... (2 Replies)
Discussion started by: yashwanthsn
2 Replies

5. Shell Programming and Scripting

shell script output in HTML or with table like results

Hello, Currently i have a ksh script which will disply the results in plain text format. I want to format the result in more readable format like Making bold headings and format with colors etc. Something like html or excel format and send that content as email. Please help me how i can do... (2 Replies)
Discussion started by: kotasateesh
2 Replies

6. Shell Programming and Scripting

search file and print results with shell script

input file 1.<CRMSUB:MSIN=0100004735,BSNBC=TELEPHON-9814060328-TS11&TS21&TS22,NDC=9814,MSCAT=ORDINSUB,SUBRES=ALLPLMN-SPICE,BAOC=OIC,BAPRC=INFO,ACCSUB=BSS,NUMTYP=MULTI;... (3 Replies)
Discussion started by: dodasajan
3 Replies

7. Shell Programming and Scripting

Shell Script Needed to Parse Results

Raw Results: results|192.168.2|192.168.2.1|general/udp|10287|Security Note|For your information, here is the traceroute from 192.168.2.24 to 192.168.2.1 : \n192.168.2.24\n192.168.2.1\n\n results|192.168.2|192.168.2.1|ssh (22/tcp)|22964|Security Note|An SSH server is running on this port.\n... (2 Replies)
Discussion started by: jroberson
2 Replies

8. Shell Programming and Scripting

Unexpected Results (at least I did not expect them)

I have two sripts running in bash. The first one uncompresses log files and moves them to a working directory using uncompress -c and > output to new directory. It then creates one control record to assure our search returns a record. It then calls or executes the second script, which is a grep for... (6 Replies)
Discussion started by: altamaha
6 Replies

9. Shell Programming and Scripting

Need help with Expect and Shell script

This is my shell script which calls an expect file, i am trying to find out server.log file sizes on various servers. But what should be correct way to do that, is there any way i can run a for loop inside the expect file which can take cat <filename> as input. I know for can be used in expect file... (1 Reply)
Discussion started by: tonan
1 Replies

10. UNIX for Dummies Questions & Answers

sql query results in unix shell script

Hi I want to get the a field from a SQL query into unix shell script variable. the whole situation is like this. 1. Opened a cursor to a table in DB2 databse. 2. Fetching individual rows with the help of cursor. 3. Each row has 4 fields. I want each of the field in individual shell... (1 Reply)
Discussion started by: skyineyes
1 Replies
Login or Register to Ask a Question