On 11/27/06, David Korn <dgk at research.att.com> wrote:
>
> > Does ksh93 have a function to handle variables like files? I'd like to
> > output sub process data to a variable which should be updated for each
> > further write from the child. foo=$(ls -l) sends all output after the
> > child terminates but I'd like to run the child in the background and
> > $foo always reflects the whole output up to the moment.
> >
> > Josh
>
> No, but you can come somewhat close to what I think you are asking
> for  using discipline functions.  For example,
>
>         function foo.set
>         {
>                 eval "@" |&

I don't grok. What does the eval "@" do?

>         }
>         function foo.get
>         {
>                 .sh.value=$foo

isn't this recursive? $foo calls foo.get which uses $foo which calls
foo.get which uses...

>                 while   read -t.01  -r -p
>                 do      .sh.value+=$REPLY$'\n'
>                 done
>         }

Why don't you use .sh.value="$(cat foo)" here?

Josh

Reply via email to