Shows and then runs a Linux command and escapes output results. No font controls are added.
The following parameters are recognized:
The command to run.
The command to echo out to user (optional).
It should be noted that this macro will collect BOTH standard out and standard error and pipe the results through html_escape (this allows the results to be shown to the user via a web browser. NOTE: You typically omit the second option - it is only required if you want to echo out a '$' symbol (like using a for loop variable).
Example of using the macro:
@runCommandNoFontCtrl("/bin/ls -al") @runCommandNoFontCtrl("for e in a b c; do echo ${e}; done","for e in a b c; do echo \\${e}; done")
Assuming the com.ccg.macros.at.All
class is within your CLASSPATH
and the
config/bash.at
macros file has been
generated (Hint: run make atmacros in the
wui
directory), a developer should be able to
run the above example by copy/pasting from below:
[root@probe root]#
java com.ccg.macros.at.All <<EOF
@include("config/bash.at",,"d")
@runCommandNoFontCtrl("/bin/ls -al") @runCommandNoFontCtrl("for e in a b c; do echo ${e}; done","for e in a b c; do echo \\${e}; done")
EOF
This macro is defined as:
@consoleExample("[${USER:-apache}@${HOSTNAME:-probe}]\\$ @bold("@htmlEscape("@fnb("@param(1)","@param(0)")")") $(@param(0) 2>&1 | html_escape)")