[NTLUG:Discuss] script hang

Kevin Brannen kbrannen at pwhome.com
Fri Mar 11 20:29:24 CST 2005


Kyle Davenport wrote:

>*** Authentication Certificate ***
>
>  
>
>>...Try taking this example and building on it.
>>
>>Also, you may have a problem with ddr1394 not behaving correctly.  It
>>may be nothing in your script. :-)  But I will also admit, your "if"
>>statement looks like psuedo code to me, not real script.  That may be
>>legal in bash, but it's nothing I've seen before.  I'll also admit I do
>>most of my script work in ksh not bash, so you might want to ignore that
>>observation. ;-)
>>
>>HTH,
>>Kevin
>>    
>>
>
>ok, I see your scripts work.  I thought I was getting the same syntax error
>you would get when you try this:
>
>while : ; do sleep 3 & ; echo ok; done
>bash: syntax error near unexpected token `;'
>
>and the work around is
>while : ; do eval "sleep 3 &" ; echo ok; done
>
>which is equivalent to calling a script which just backgrounds another job.
>  
>

Again, you don't need the eval, unless your subprocess gives you values 
you must pull back into the parent process (e.g. environment vars).  The 
problem you're having here is that you're doing it on 1 line, so the "&" 
gets parsed incorrectly and can't be applied correctly (that may be bad 
wording).  Try:

while : ; do
sleep 3 &
echo ok; done


>yes, my if's were pseudocode.  It's definitely the ddr1394 misbehaving - I
>just don't know why I can't duplicate in a script what I'm doing on the
>command line.   The ddr1394 process is definitely gone after I do the "kill
>$PID", but something is hanging around that crashes it after the 3rd
>restart.
>  
>

You might try "strace ddr1394" and see what it's doing; that may give 
you a clue.

Good luck! :-)
Kevin




More information about the Discuss mailing list