This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Awk not ouputting results via echo


Ok, I think I have a sense of an underlying problem here.

When you do:  ... | read v1 v2 ...

The read executes in an inferior process, setting variables there.
The process then exits and you have no bindings in the parent shell,
which is where you want them.

Maybe something like this would suit you better:

myfunction() {
  ... stuff using positional arguments $1, $2, etc.
}

myfunction $(awk blah ...)

This take the output of the invocation of awk and puts it
where $(awk ...) was, which will invoke myfunction with
the line, parsing it into separate arguments (I believe).

You could also capture the line using something like this:

line="$(awk ...)"

and then you can fiddle the result however you want, but I think that
calling a function (or another script) is probably simpler here.

Regards -- Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]