Afficher un message
Vieux 22/08/2006, 16h27   #3
mr.bmonroe@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Setting a variable via STDIN

Bill Marcum wrote:
> On 22 Aug 2006 07:16:08 -0700, mr.bmonroe@gmail.com
> <mr.bmonroe@gmail.com> wrote:
> > Hey all,
> >
> > I have a script (using ksh88) that takes in STDIN and stores it within
> > a variable.
> >
> > Is it more apropriate to use 'cat' to do this ala:
> >
> > FOO=$(cat)
> >
> > or is it acceptabe (prefered) to do it this way:
> >
> > FOO=$(</dev/fd/0)
> >
> > This is how I am doing it now but am I setting my self up for trouble
> > in the future?
> >

> The usual way is "read FOO", unless you want FOO to contain more than
> one line. If that is the case, remind the user to press ctrl-D at the
> end.


Bill,

Two things (sorry I didn't mension them in my first email):

First, the script is not interactive, it is called by a 3rd party
program that spews a report to STDOUT.

Second, the output is multilined and can be anywhere from 10 to 50+
lines long. I want to map the text to a variable so as to avoid
parsing a temp file over and over (with the rest of the script). The
parsing is simple so I am using expr for the most part.

Thanks
--Brett

  Réponse avec citation
 
Page generated in 0,07093 seconds with 9 queries