Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.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 file 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 tmpfile1 tmpfile2
==
== Create a Guardian temporary file named tmpfile1
== to hold the output; a second file would be needed
== if there was more than one line of output (see below):
==
#SET/TYPE DELTA/cmds 0,Z-4K
[ #LOOP |DO|
#SET tmpfile1 zz[ #DELTA/COMMANDS cmds/
[#TIMESTAMP] ]
|UNTIL| NOT
[ #FILEINFO/EXISTENCE/ tmpfile1 ]
]
CREATE [tmpfile1]
==
== Redirect the output of the OSS shell
== gname command to the Guardian temporary file
==
osh -p gname -s %1% > [tmpfile1]
==
== Read the temporary file into the TACL variable and
== delete the trailing newline character; if the output
== will contain more than one line, convert the file
== to an EDIT file using CTOEDIT [tmpfile1] [tmpfile2]
== and omit the #CHARDEL line:
==
FILETOVAR [tmpfile1] %2%
#CHARDEL %2% [ #CHARCOUNT %2% ] FOR 1
SINK [ #PURGE [tmpfile1] ]
==
== Remove no longer needed TACL variables
==
6−106 Hewlett-Packard Company 527188-021