| To add a shell command to a jobYou can link a
shell command to a
job. You can also link a
command file (cmd file), or a Visual Basic script. To add a command or script to a job, complete these
steps: - Start the
添加 Shell 命令至作业 (ttaad5205m000) session.
Specify this information: - The name of the command or script
- The arguments for the command or script
- A return value
See
添加 Shell 命令至作业 (ttaad5205m000). Click
测试脚本. The command or script is executed with the specified
arguments. If the execution fails, an error message is displayed. Typically, to test the command or script, you must redirect
its output. See Output redirection. Click Add to Job. The
添加进程至作业 (ttaad5102s000) session starts. Select the job to which you want to link the command or
script and specify the required information. See
添加进程至作业 (ttaad5102s000) and
将进程添加到作业. Click OK.
Output redirection You must redirect the output of the command or script to a
file or printer. Use the operating system's redirection facilities in the code
of the command file or script. In a Unix shell script, you can use the > and | characters
to redirect the output. For example, a Unix shell script can contain these
lines of code: find / -name core > /tmp/results 2>/tmp/errors | Search the file system for files named core.
Redirect the standard output, the list of files found, to the /tmp/results
file. Redirect any error messages to the /tmp/errors file. | df | lp -dpr1050 | Print the output of the df command, a report of the
free disk space, on printer pr1050. | df | mailx -s "Free disk space" jdoe@mycomp.com | Mail a report of the free disk space, with
subject "Free disk space", to jdoe@mycomp.com. |
For details on output redirection, refer to your operating
system documentation. | |