Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


3.5 Outputting the executed commands and their arguments

When the xtrace shell option is enabled, the executed commands and their arguments are output to the standard error output as trace information.

There are three ways to enable the xtrace shell option:

The trace information is output in the following format:

Example of trace information output

This example shows an executed job definition script and the trace information that is output.

Contents of the job definition script
0001 : set -o xtrace
0002 : typeset -i cnt=1
0003 : if [ $cnt -eq 1 ]
0004 : then
0005 :   echo "--- JOB START ---"
0006 : fi
0007 : date
Standard error output results
+ typeset -i cnt=1
+ [ 1 -eq 1 ]
+ echo --- JOB START ---
+ date
Notes about trace information

Even when the xtrace shell option is enabled, the following commands and their arguments are not output:

  • Commands in the [[ ]] format that is the abbreviated form of the test command

  • Extended script commands

Commands in the (( )) format that is the abbreviated form of the let command are replaced with the let command in the trace information. The following shows an example of a command in the (( )) format and the output information:

Contents of the job definition script
0001 : set -o xtrace
0002 : typeset -i a=0
0003 : (( a=(2+3)*9 ))
0004 : echo $a
Standard error output results
+ typeset -i a=0
+ let  a=(2+3)*9
+ echo 45

Trace information for functions themselves are output, but trace information for commands within the functions is not output. To output trace information for commands within a function, execute the typeset command to enable the function's trace mode. The following shows an example of the typeset command's specification and the output information:

Contents of the job definition script
0001 : set -o xtrace
0002 : fn1(){
0003 :   echo "call $1 $2"
0004 :   echo $LINENO
0005 : }
0006 : echo "in main"
0007 : fn1 "function" "1"
0008 : typeset -ft fn1
0009 : fn1 "function" "2"
Standard error output results
+ echo in main
+ fn1 function 1
+ typeset -ft fn1
+ fn1 function 2
+ echo call function 2
+ echo 4

When the xtrace shell option is enabled, trace information for the job definition script executed by the child job is output, but trace information for the commands within the child job is not output. To output trace information for a job definition script that is executed by a child job, also enable the xtrace shell option within the child job's job definition script.

The input contents of here documents are not output as trace information even when the xtrace shell option is enabled.