Hello,
I have a script that fills an array in a 'for' loop with the output from a diff command. The script generally works, but the program inevitably hangs at some point in the loop before executing the line after the diff command. Furthermore, there seems to be no apparent rhyme or reason to when the program freezes--during one execution of the program, it will get stuck on a particular iteration of the loop, but it will have no problems with that item the next time around, or it will get stuck on an element that was successfully processed before.
I can also apparently goad the program into continuing its execution by killing the diff subprocess, but it's not clear whether the array is correctly filled with the output from diff in this case.
Any help would be greatly appreciated, thanks!
Script hangs during/after "diff" command
Page 1 of 13 Replies - 616 Views - Last Post: 06 February 2012 - 08:54 AM
Topic Sponsor:
Replies To: Script hangs during/after "diff" command
#2
Re: Script hangs during/after "diff" command
Posted 04 February 2012 - 12:50 PM
Can we see the script?
#3
Re: Script hangs during/after "diff" command
Posted 04 February 2012 - 01:23 PM
Did you try attaching the Psychic Debugger to your process?
#4
Re: Script hangs during/after "diff" command
Posted 06 February 2012 - 08:54 AM
KYA, on 04 February 2012 - 12:50 PM, said:
Can we see the script?
Of course, my mistake. Here is a condensed version that still displays the problematic behavior.
for d in $dir1/*
do
dirname=`basename $d`
echo $dirname
p_dates=(`diff <(ls ./$dir1/$dirname/$dir2) <(ls $dir3 | xargs -I {} basename {} .txt | cut -c 8-) | sed 's/^> //g' | awk '{if (!($0 ~ /[a-z]/)) print}'`)
len=${#p_dates[*]}
echo $len
for i in "${p_dates[@]}"
do
echo $i
done
done
Also, in case it's relevant, I'm running this on cygwin.
Thanks again for your time.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|