The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Expect Script - No End domi55 Shell Programming and Scripting 1 02-22-2009 12:45 PM
strange expect script behavior, or am i misunderstanding expect scripting? v1k0d3n Shell Programming and Scripting 2 12-10-2008 04:31 PM
expect question pbaets01 UNIX for Dummies Questions & Answers 4 11-04-2008 03:40 PM
Using expect script in a shell script or vice versa nua7 Shell Programming and Scripting 0 07-18-2008 08:16 AM
question regarding EXPECT finnje Shell Programming and Scripting 2 02-04-2005 10:23 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-25-2009
manouche manouche is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 13
Question about an expect script

I am using Expect to spawn a command that loops through a text file and runs the same command for each item in the text file.

The text file, named stat.txt looks something like this:

2007-04 alist 543
2008-07 blist 543
2008-03 xlist 345
2008-03 ylist 675
2003-03 zlist 567

The expect script looks like this:

#!/usr/bin/expect

set timeout 600
set input [open "/tmp/stat.txt" "r"]

while {[gets $input line] != -1} {

#####################################
# separates agency code from listname
#####################################

set datecreated [lindex $line 0]
set listname [lindex $line 1]
set agency [lindex $line 2]

set newfile $listname.members.$agency.$datecreated
spawn /usr/local/mailman/bin/list_members -o /tmp/lists/test/$newfile $listname
}

close $input

---------------------------------------
The script looks at the 'listname' field in the text file, spawns the command 'list_members' for each one and creates a separate file for each, containing the email addresses of those on the list.

The script works as I want until it gets to the listname beginning with 'y'. When I run the script, I see the spawning until the end, as if it actually creates a file for each listname. However, when I do a listing on /tmp/lists/test, there are no files beyond the 'x' name. Is there a way I can see why the spawn is not working for those particular items, even though it appears that it is?

Thanks.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0