Dear Martin,

Thank you for your very thoughtful and polite reply.

If I understand correctly, you thought the

    > ./d 2>&1

in
    
    $ echo 'set -x; echo "a" >> /dev/stderr ; echo "b" >> /dev/stderr' > ./c ; 
chmod 755 ./c ; ./c > ./d 2>&1 ; cat ./d ; rm ./c ./d

opens fd#2 without O_APPEND.

I seem to have worked around the problem by changing

    > ./d 2>&1

to

    >> ./d 2>&1

Ie: 

    $ echo 'set -x; echo "a" >> /dev/stderr ; echo "b" >> /dev/stderr' > ./c ; 
chmod 755 ./c ; ./c >> ./d 2>&1 ; cat ./d ; rm ./c ./d

My theory is that the additional ">" causes 

    1.) bash to open fd#2 with O_APPEND,

    2.) fd#2's file pointers to be kept in a consistent state, and

    3.) the missing "a" to appear.

What do you think?

Does that make sense?

Thanks,
Kingsley

-- 
Time is the fire in which we all burn.


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to