awk question

Mick Ortwein ortwein at BRL.MIL
Tue Jun 12 03:49:56 AEST 1990


Last I remember (when awk was my life), in order to bring
a shell variable into awk you need to use single quotes around
the variable.  The effect is that the value of the variable is
written on top of the quoted word before awk interprets the rest
of the commands (sort of a preprocessor if you will).

Put the following two lines into a file called "example"

#!/bin/sh
awk '{printf("%s\n","'$HOME'")}' <example

When you execute this shell script the output should be:

/other/ortwein
/other/ortwein

(or whatever the HOME path is for you...)
-Mick (C is my life) Ortwein



More information about the Comp.sys.sgi mailing list