On Mon, May 14, 2007 at 02:49:21PM -0700, Bob McGowan wrote:
> Alex Samad wrote:
> >On Mon, May 14, 2007 at 09:13:32AM -0700, Bob McGowan wrote:
> >>cga2000 wrote:
> >>>On Fri, May 11, 2007 at 12:33:12PM EDT, Bob McGowan wrote:
> >>>
> >>><snip>
> >>>
> >>>> 3. in the parent script, where you use your script, change it to be:
>
> <and more snipped>
>
> >>So:
> >>
> >> $ echo a b c d | read x y z p
> >> $ echo $x $y $z $p
> >> a b c d
> >
> >what about something like
> >
> >set -- 1 2 3 4 5 6 7
> >for x
> >do
> > echo $x
> >done
> >
> >
> >change 1 2 3 4 5 6 7 for what every number of variables you want ?
> >
> ---XXX---
>
> Reminder: the original poster wanted to have data passed backward (up
> the process tree) from a child script to a parent.
>
> Collecting the output of a command using 'command substitution' is most
> easily handled as a single variable or line of data. You can make the
> method of passing the data out of the child as complex as you like, but
> in the calling script:
>
> lineIn=$(child )
>
> puts one long string in $lineIn, including newline characters, spaces,
> tabs and so on. The result, using your 'set...loop', would put newline
> separated numbers into the returned string.
>
> Further processing would then need be done on the string to break it up
> into pieces, or not, as dictated by the needs of the caller. My 'child
> | read a b c d' is a quick way to read in the multiple lines output by
> your method, or to break a long line up on any white space characters.
> Without using the arrays suggested by another poster, which may not be
> supported by all versions of Bourne type shells.
what about something like this
NL='
'
IFS=$NL
set -- $(find "$IND" -regextype posix-egrep -type f -iregex ".*\.(ogg)"
-printf "%P\n")
unset IFS
for x
do
dosomething with $x
done
or they could be available with $* or ${1,2,3,4,5}
>
> Bob
Attachment:
signature.asc
Description: Digital signature