COMMAND_CONV_ARG parameter (defines a rule for converting an argument in job definition scripts during command execution)
- Organization of this page
Format
#-adsh_conf COMMAND_CONV_ARG command-argument-1 command-argument-2
Description
This parameter defines a rule for converting an argument in standard shell commands, extended shell commands, functions, extended script commands, reserved script commands, external commands, and user programs used in job definition scripts.
When a job definition script is run, a command argument that matches exactly command-argument-1 is converted to command-argument-2. Both command-argument-1 and command-argument-2 must be specified.
If different rules are defined for the same command argument, the first rule defined takes effect.
External scripts specified in . (dot) commands and #-adsh_script commands are also subject to this argument's conversion if they satisfy the specified rule during execution.
The KNAX6804-I or KNAX6806-I message is output to the job execution logs as the conversion result.
Operands
- command-argument-1 ~<any character string>((1 to 247 bytes))
-
Specifies the command argument before conversion. To specify a command argument containing a space, enclose the entire command argument in double quotation marks ("). A value enclosed in double quotation marks cannot consist of only a space, tab character, or null character. None of the following characters is permitted:
* ? < > | ` (grave accent mark) $
If command-argument-1 is omitted or the value specified in command-argument-1 is invalid, the command will terminate with an error during parameter analysis.
- command-argument-2 ~<any character string>((1 to 247 bytes))
-
Specifies the command argument after conversion. To specify a command argument containing a space, enclose the entire command argument in double quotation marks ("). A value enclosed in double quotation marks cannot consist of only a space, tab character, or null character. None of the following characters is permitted:
* ? < > | ` (grave accent mark) $
If command-argument-2 is omitted or the value specified in command-argument-2 is invalid, the command will terminate with an error during the parameter analysis.
Notes
-
If this parameter is defined in both the system environment file and the job environment file, both definitions take effect. However, if the total number of times this parameter is defined in the system environment file and the job environment file combined exceeds 255, an error occurs.
-
If the command argument obtained after conversion is the same as the command argument before conversion in a subsequent parameter and the eval command containing the argument that satisfies the rule is executed, conversion is performed twice, once during execution of the eval command and once during execution of the command of that argument, as shown in an example below.
Example:
Contents of environment file
#-adsh_conf COMMAND_CONV_ARG /tmp /var/tmp <--1. #-adsh_conf COMMAND_CONV_ARG /var/tmp /jp1as/tmp <--2.
Contents of job definition script
eval cd /tmp
In this example, the following conversions occur on the corresponding lines in the environment file:
-
The eval command is executed and /tmp is converted to /var/tmp.
-
The cd command is executed and /var/tmp is converted to /jp1as/tmp.
-
-
The argument obtained after conversion by this parameter is interpreted as a single character-string argument even if it contains characters that match the IFS shell variable, which is the string separator. Therefore, if the character string obtained as a result of parameter conversion contains a metacharacter and the command to be executed is not eval, that character is treated as a normal character, not a metacharacter.
Contents of environment file (IFS shell variable is the space)
#-adsh_conf COMMAND_CONV_ARG "D:\JP1AS" "C:\\Documents and Settings" <-- Argument conversion rule 1 #-adsh_conf COMMAND_CONV_ARG "A=1" "A=1 &" <-- Argument conversion rule 2
Contents of job definition script
cd "D:\JP1AS" <--1. readonly A=1 <--2. eval cd "D:\JP1AS" <--3. eval readonly A=1 <--4.
-
The argument is converted as follows according to conversion rule 1:
cd "C:\\Documents and Settings"
-
The character string is separated as follows according to conversion rule 2:
readonly A=1 &
-
When the eval command is executed, the argument is converted as follows according to conversion rule 1:
eval cd "C:\\Documents and Settings"
However, when the cd command is executed, the argument is separated and interpreted as follows:
cd C:\Documents and Settings
-
When the eval command is executed, the argument is converted as follows according to conversion rule 2:
eval readonly A=1 &
However, when the readonly command is executed, the argument is separated and interpreted as follows:
readonly A=1 &
-
-
This parameter performs conversion in such a manner that variable substitution and file name substitution are resolved. Therefore, if a character string containing a wildcard is specified as the argument, the character string obtained after substitution by the wildcard is recognized as the command's argument.
-
If this parameter is applied to the test command, the interpretation of the character string in the argument during command execution depends on the format used. In the [[ ]] format, if a variable substitution is specified for array elements, conversion by this parameter is not applied. To use this parameter to convert a command's argument by using the test command, we recommend that you use the test or [ ] format.
Example:
Contents of environment file
#-adsh_conf PATH_CONV_ENABLE \\ : #-adsh_conf COMMAND_CONV_ARG "/tmp2" "/tmp" <-- Argument conversion rule 1 #-adsh_conf COMMAND_CONV_ARG "ARY[1]" "/tmp" <-- Argument conversion rule 1
Contents of job definition script
ARY[0]="/var" Stores "/var", "/tmp2", and "/home" in the array ARY. ARY[1]="/tmp2" ARY[2]="/home" id1=1 [[ -d ${ARY[$id1]} ]] <-- Replaces ${ARY[$id1]} through "/tmp2". Converted to "/tmp" according to argument conversion rule 1. [[ -d ARY[$id1] ]] <-- "ARY[$id1]" becomes the argument because substitution is not performed. Not subject to conversion because "$" cannot be specified. [ -d ${ARY[$id1]} ] <-- Replaces ${ARY[$id1]} through "/tmp2". The result of substitution is converted to "/tmp" according to argument conversion rule 1. [ -d ARY[$id1] ] <-- Replaces ${ARY[$id1]} through "ARY[1]" Converted to "/tmp" according to argument conversion rule 1.
-
If any of the commands listed below is executed, the command specified in the argument is actually executed, but this parameter performs comparison and conversion also on the command specified in the argument:
-
builtin command
-
command command
-
eval command
-
exec command
-
time reserved command
Example:
In this example, pwd specified in the argument of the builtin command is actually executed, but the readonly command is executed according to the definition in the environment file.
Contents of environment file
#-adsh_conf COMMAND_CONV_ARG pwd readonly
Contents of job definition script
builtin pwd
-
-
The conversion rules are searched in the order they are defined and the first conversion rule that matches the conversion condition is applied.
-
If conversions are defined for the same path name by using this parameter and the PATH_CONV parameter, the conversion defined by the PATH_CONV parameter is performed first. To convert the path name obtained after conversion by the PATH_CONV parameter further by the COMMAND_CONV_ARG parameter, specify the path name converted by the PATH_CONV parameter.
-
Use this parameter carefully, because each time a command is executed, all arguments specified in COMMAND_CONV_ARG parameters are scanned. Therefore, if you specify this parameter many times, the job definition script's execution time might be affected adversely.
-
To specify a character string containing a backslash (\), not a metacharacter, in command-argument-2, specify \\ instead of \.
Example
-
This example converts "/tmp" to "C:\temp" to run in Windows a job definition script created for UNIX:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf COMMAND_CONV_ARG /tmp "C:\\temp"
-
This example converts "C:\temp" to "/tmp" to run in UNIX a job definition script created for Windows:
#-adsh_conf PATH_CONV_ENABLE \\ ; #-adsh_conf COMMAND_CONV_ARG "C:\temp" /tmp