Re: output redirection with process substitution asynchronous?

2009-12-12 Thread pjodrr
Hello again, I have to reply to my own post to correct it: On Dec 8, 2:00 pm, pjodrr pjo...@gmail.com wrote: coproc prefix_timestamp seq 10${COPROC[1]} eval exec ${COPROC[1]}- cat ${COPROC[0]} wait $COPROC_PID replace this with: { coproc prefix_timestamp 3 ; } 31 seq 10${COPROC[1]} eval

Re: output redirection with process substitution asynchronous?

2009-12-08 Thread Marc Herbert
pk a écrit : I disagree. All the further changes in the requirements because creating a subshell or being asynchronous is not acceptable etc. are not a goal in themselves, but rather the indicators that he's trying to accomplish something else. I think he just want side-effects like in

Re: output redirection with process substitution asynchronous?

2009-12-08 Thread pjodrr
On Dec 8, 11:05 am, Marc Herbert marc.herb...@gmail.com wrote: pk a écrit : I disagree. All the further changes in the requirements because creating a subshell or being asynchronous is not acceptable etc. are not a goal in themselves, but rather the indicators that he's trying to

Re: output redirection with process substitution asynchronous?

2009-12-08 Thread pjodrr
On Dec 8, 10:55 am, Marc Herbert marc.herb...@gmail.com wrote: DennisW wrote : Would you care to comment on the coproc command in Bash 4? I wish I could, but I know nothing about it. Anyone else? yeah, I tried that: prefix_timestamp() { while read line; do echo $(date): $line

Re: output redirection with process substitution asynchronous?

2009-12-07 Thread Marc Herbert
pjodrr wrote: It would be nice if you explained what it is you're attempting to do, rather than ask for a solution for what you're thinking would do that. To be honest that is the first thing he (tried to) do: pjodrr wrote: how can I prefix every line of output of some command with a

Re: output redirection with process substitution asynchronous?

2009-12-07 Thread Marc Herbert
Marc Herbert wrote: What is wrong with the following: prefix_with_date () { while read; do printf '%s: %s\n' $(date) $REPLY; done } seq 4 | prefix_with_date ls | prefix_with_date Sorry I missed the fact that you want to run your commands in the current shell.

Re: output redirection with process substitution asynchronous?

2009-12-07 Thread DennisW
On Dec 7, 10:25 am, Marc Herbert marc.herb...@gmail.com wrote: Marc Herbert wrote: What is wrong with the following: prefix_with_date () {     while read; do         printf '%s: %s\n' $(date) $REPLY;     done } seq 4 | prefix_with_date ls | prefix_with_date Sorry I missed

Re: output redirection with process substitution asynchronous?

2009-12-07 Thread pjodrr
Hi Marc, On Dec 7, 5:25 pm, Marc Herbert marc.herb...@gmail.com wrote: Marc Herbert wrote: What is wrong with the following: prefix_with_date () {     while read; do         printf '%s: %s\n' $(date) $REPLY;     done } seq 4 | prefix_with_date ls | prefix_with_date Sorry I

Re: output redirection with process substitution asynchronous?

2009-12-06 Thread pjodrr
On Dec 5, 4:45 pm, pk p...@pk.invalid wrote: pjodrr wrote: Hi On Dec 4, 7:58 pm, pk p...@pk.invalid wrote: What's wrong with seq 4 | while read line; do echo $(date): $line; done it creates a subshell uh...where do you think your original (while read line; do echo $(date): $line;

Re: output redirection with process substitution asynchronous?

2009-12-06 Thread pk
pjodrr wrote: in my original example the seq 4 runs in the current shell while here the command runs in a subshell. It would be nice if you explained what it is you're attempting to do, rather than ask for a solution for what you're thinking would do that.

Re: output redirection with process substitution asynchronous?

2009-12-05 Thread pjodrr
On Dec 4, 7:46 pm, DennisW dennistwilliam...@gmail.com wrote: This should be in gnu.bash rather than gnu.bash.bug oh, you are right, it's not a bug yet Would this work for you? while read line; do echo $(date): $line $((num++)); done ah sorry, I used the command seq just as an example, it

Re: output redirection with process substitution asynchronous?

2009-12-05 Thread pjodrr
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

Re: output redirection with process substitution asynchronous?

2009-12-04 Thread DennisW
On Dec 4, 9:28 am, pjodrr pjo...@gmail.com wrote: Hello, how can I prefix every line of output of some command with a timestamp?  I thought like this: $ exec 3 (while read line; do echo $(date): $line; done) $ seq 4 3 Friday, December  4, 2009  4:20:29 PM MET: 1 $ Friday, December  4,

Re: output redirection with process substitution asynchronous?

2009-12-04 Thread pk
pjodrr wrote: Hello, how can I prefix every line of output of some command with a timestamp? I thought like this: $ exec 3 (while read line; do echo $(date): $line; done) $ seq 4 3 Friday, December 4, 2009 4:20:29 PM MET: 1 $ Friday, December 4, 2009 4:20:29 PM MET: 2 Friday,

Re: output redirection with process substitution asynchronous?

2009-12-04 Thread DennisW
On Dec 4, 12:58 pm, pk p...@pk.invalid wrote: pjodrr wrote: Hello, how can I prefix every line of output of some command with a timestamp?  I thought like this: $ exec 3 (while read line; do echo $(date): $line; done) $ seq 4 3 Friday, December  4, 2009  4:20:29 PM MET: 1 $