Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
User Commands (m - o) osh(1)
11. Passing text and multiple shell commands using a TACL macro as a substitute for a UNIX
Here-document:
?TACL MACRO
#FRAME
==
== First, create a Guardian file named msg
== containing text. To do this,
== add the TACL variable to be used, then
== place character strings in it.
==
#PUSH msg
#APPEND msg ****************
#APPEND msg * Hello world! *
#APPEND msg ****************
[ #IF [#FILEINFO/EXISTENCE/ msg] |THEN|
SINK [#PURGE msg] ]
==
== Write the variable to the Guardian file
==
VARTOFILE msg msg
==
== Next, create a Guardian file named cmds
== containing OSS shell commands. To do this,
== add the TACL variable to be used, then
== place character strings in it.
==
#PUSH cmds
#APPEND cmds echo ’cp msg /tmp/msg’
#APPEND cmds cp msg /tmp/msg
#APPEND cmds echo ’cat /tmp/msg’
#APPEND cmds cat /tmp/msg
#APPEND cmds echo ’rm /tmp/msg’
#APPEND cmds rm /tmp/msg
[ #IF [#FILEINFO/EXISTENCE/ cmds] |THEN|
SINK [#PURGE cmds] ]
==
== Write the variable to the Guardian file
==
VARTOFILE cmds cmds
==
== Now, run a shell to process the commands
== in the Guardian file cmds
==
osh +ls cmds
==
== Remove no longer needed Guardian files
==
SINK [#PURGE cmds]
SINK [#PURGE msg]
#UNFRAME
527188-003 Hewlett-Packard Company 6−103