![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with exec command and file descriptors II | masaki | Shell Programming and Scripting | 2 | 01-03-2009 11:27 PM |
| Accessing input from another file | krishnan_6015@y | Shell Programming and Scripting | 2 | 11-26-2007 02:04 AM |
| Help with exec command and file descriptors?? | rfourn | Shell Programming and Scripting | 1 | 07-18-2007 07:05 PM |
| How to input .txt file into .xls spreadsheet | wereyou | Shell Programming and Scripting | 1 | 12-22-2006 03:33 PM |
| how to get input from file | ajaya | Shell Programming and Scripting | 1 | 04-05-2006 03:02 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
exec w/input file
Why is my code not doing what I want it to do? I have 3 files that I want to process that are in format file123, file456, file789. Code:
echo "Processing each file one at a time..."
cd $dir
ls -r1 file???.dat > input.dat
exec < input.dat
IFS='|'
while read INPUT_FILE ; do
echo INPUT_FILE = $INPUT_FILE 1>/dev/null
echo "Processing file $INPUT_FILE..."
if [[ -s $INPUT_FILE ]]; then
ksh script1.ksh
else
echo "$INPUT_FILE was empty."
exit 1
fi
echo "Renaming processed file $INPUT_FILE..."
mv $INPUT_FILE $INPUT_FILE.done
done
The problem is that as soon as the script1.ksh launches, this main script doesn't wait for all 10 scripts to finish (script1.ksh ends then calls script2.ksh, which calls script3.ksh, etc..all the way to script10.ksh) before it attempts to process the second input file. Why?? I was thinking that it would only execute the second file once I reach the rename part (and that's after it had finished all 10 scripts) but it doesn't. It kicks off script1.ksh and then it renames my files before, say script5.ksh even had a chance to work with the input file. Any ideas on how to make sure all 10 scripts execute for each iteration/each file? Right now, things are getting clobbered...and I want things done in sequence... Gianni added code tags for readability --oombera Last edited by oombera; 02-19-2004 at 04:15 PM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|