bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bizarre trap behavior while reading a file


From: Chet Ramey
Subject: Re: bizarre trap behavior while reading a file
Date: Mon, 28 Mar 2011 14:50:05 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

On 3/28/11 12:03 PM, tytus64 wrote:

> OK. Thanks everybody for their input. Really appreciate all the answers. I
> modified the first loop as follows to get the subshell to ignore HUP signal:
> 
> 
> trap "" HUP; cat $log_file | {
>     while read line
>     do
>       line_num=`expr $line_num + 1`
>       echo $line_num: $line >> ./out.log
>     done
> }

You might have better luck moving the trap command inside the { ... },
before the while loop.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]