On Dec 5, 3:14 am, pjodrr <pjo...@gmail.com> wrote: > Hello, > > On Dec 4, 8:18 pm, DennisW <dennistwilliam...@gmail.com> wrote: > > > It works for me. Does it not for you? If you're asking why not do it, > > then the answer is "why call an external program unnecessarily?". > > > Sorry, by the way, I missed what you were doing with the file > > descriptor on my first read. What is it that you're trying to > > accomplish? Are you doing this only to number the lines or is either > > seq or the while loop a stand-in for something else? > > the seq was only an example for demonstration. > here is another example that shows what I mean: > > $ exec 3> >(while read line; do echo "tag: $line"; done) > $ seq 4 >&3 > tag: 1 > tag: 2 > tag: 3 > tag: 4 > > $ exec 3> >(while read line; do echo "$(date): $line"; done) > $ seq 4 >&3 > $ Sat Dec 5 10:11:25 CET 2009: 1 > Sat Dec 5 10:11:25 CET 2009: 2 > Sat Dec 5 10:11:25 CET 2009: 3 > Sat Dec 5 10:11:25 CET 2009: 4 > > while in the first example the prompt returns after the > command completes, the prompt returns immediately > in the second example. > > thanks for your attention, > > Peter
Your example here: $ exec 3> >(while read line; do echo "tag: $line"; done) $ seq 4 >&3 just executes too quickly to exhibit this behavior. Try this and it will do it, too: $ exec 3> >(while read line; do for i in {1..10000}; do :; done; echo '.'; done) $ seq 4 >&3 I think the thing to remember is that doing this is like running something in the background with "&". So, yes, it's going to be asynchronous.