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

Re: Korn shell script Question



On 2/2/07, Kris Maglione <bsdaemon_(_at_)_comcast_(_dot_)_net> wrote:

On Fri, Feb 02, 2007 at 11:10:02AM -0500, Dak Ghatikachalam wrote:
>{ while cat /tmp/availspace.$$; do false; done } |&
>exec 5<&p
>cat  /tmp/reprocesses.$$|awk '/DATAFILE/ { print $0 }'|tr -d ' '|
>while read file_b
>do
>        read -u5 file_a
>        echo $file_b $file_a
>done >/tmp/reprocessrecset.$$
>
>exec 5<&-
>
>this what you meant ?

It doesn't matter where you put the redirects, so long as they're in
order and you wind up closing the coprocess's standard output so that it
exits. It's more a matter of style and taste than anything. Here are
some more options if you're interested:

As long as you haven't started any other background jobs, this would
work in place of the final 'exec 5<&-':
kill -INT %+

Or, after you start the coprocess, you can store its PID, and kill that
later:
copid=$!
...
kill -INT $copid

Again, it's a matter of style and taste. If it's not to be part of a
long running script, though, don't even worry about it.


Kris,

That is great , Thanks  a lot for your  input and insight.

It just amazes me how powerful a korn shell script in general  any Unix
shell, process handling  can be.

Thanks
Dak
_______________________________________________
freebsd-questions_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe_(_at_)_freebsd_(_dot_)_org"