[K12OSN] General bash and gawk question.

Les Mikesell les at futuresource.com
Thu Apr 15 02:40:57 UTC 2004

On Wed, 2004-04-14 at 16:56, Larry Mateo wrote:

> I'm new to shell  programming, and have a question to which I cannot find an answer despite my searching various manuals and the internet.
> Is it possible to populate array variables from within the gawk portion of a bash script, and then make the array values accessible by succeeding lines outside of the gawk code but within the same bash script?

Not directly - programs run as parts of a script can't change
variables in their parent process.  Generally they write to
their standard output and the shell either executes the
progam in a way that reads the output into a variable,
expands it into the next command line, or pipes it
into the input of the next program.   There are size
limits on the first two.  If you need more than that you
might be better off using perl which can do everything
awk can do plus everything the shell can do and then

  Les Mikesell
   les at futuresource.com

More information about the K12OSN mailing list