Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)

osh(1) OSS Shell and Utilities Reference Manual
12. Using the output from an OSS command in the TACL variable VAR1:
#SET #INFORMAT TACL
OBEY GNMTOVAR
#PUSH VAR1
GNAMETOVAR /usr/donl/printcap VAR1
OUTVAR VAR1
\BOSTON.$XPG.ZYQ00000.Z0000M5L
where the le GNMTOVAR contains the following code:
== This macro has the following runtime syntax:
==
== GNAMETOVAR <OSS_pathname> <TACL_variablename>
==
== where <OSS_pathname> is represented as %1% and
== <TACL_variablename> is represented as %2%
==
[ #DEF GNAMETOVAR MACRO |BODY|
==
== Add temporary TACL variables to be used
==
#PUSH cmds tmple1 tmple2
==
== Create a Guardian temporary le named tmple1
== to hold the output; a second le would be needed
== if there was more than one line of output (see below):
==
#SET/TYPE DELTA/cmds 0,Z-4K
[ #LOOP |DO|
#SET tmple1 zz[ #DELTA/COMMANDS cmds/
[#TIMESTAMP] ]
|UNTIL| NOT
[ #FILEINFO/EXISTENCE/ tmple1 ]
]
CREATE [tmple1]
==
== Redirect the output of the OSS shell
== gname command to the Guardian temporary le
==
osh -p gname -s %1% > [tmple1]
==
== Read the temporary le into the TACL variable and
== delete the trailing newline character; if the output
== will contain more than one line, convert the le
== to an EDIT le using CTOEDIT [tmple1] [tmple2]
== and omit the #CHARDEL line:
==
FILETOVAR [tmple1] %2%
#CHARDEL %2% [ #CHARCOUNT %2% ] FOR 1
SINK [ #PURGE [tmple1] ]
==
== Remove no longer needed TACL variables
==
6104 Hewlett-Packard Company 527188-003