Re: Mixing exec redirection with explicit redirection, unexpected results

2009-12-08 Thread Chet Ramey
r...@enterprise.herff-jones.com wrote: > When I use the 'exec' built-in to redirect standard output > for a script, and then also use explicit redirection on > other commands, pointing both to the same output file, > I get unpredictable (but repeatable) results with the

Re: Mixing exec redirection with explicit redirection, unexpected results

2009-12-08 Thread John Reiser
#!/bin/bash > /tmp/foo exec 1>/tmp/foo echo a echo B>>/tmp/foo echo c echo D>>/tmp/foo echo e echo F>>/tmp/foo That script creates two simultaneous writers of /tmp/foo (one via the "exec >", another via each "echo >>") but does not provide any concurrency control. Shame on the script; the resu