PATH_CONV_RULE parameter (defines a rule for converting file paths) (Windows only)
- Organization of this page
Format
#-adsh_conf PATH_CONV_RULE {1|2}
Description
This parameter defines (selects) a rule for converting file paths. It is effective when file path conversion is defined in the PATH_CONV parameter or the #-adsh_path_var command. If this parameter is omitted, path conversion rule 1 goes into effect.
If a path separator is defined in the PATH_CONV_ENABLE parameter, the separated ranges are converted. The separator defined in the PATH_CONV_ENABLE parameter is converted into a separator to be used by the OS that executes the job definition script.
Operands
- 1
-
Specifies selection of path conversion rule 1.
Only a range enclosed in double quotation marks (") is converted.
- 2
-
Specifies selection of path conversion rule 2.
Character strings separated by the separators shown below under Separators used in path conversion rule 2 are converted. Character strings that are separated here are further separated by a path separator (defined in the PATH_CONV_ENABLE parameter) and are then converted. Note, however, that characters enclosed in double quotation marks (") and ${ } are not converted.
If the location to be converted is not enclosed in double quotation marks ("), the conversion results will be enclosed in double quotation marks ("). Additionally, the ranges listed below will also be enclosed in double quotation marks (").
-
Path separator
Converted to ";".
-
$shell-variable-name
Also includes shell variables that are not specified by the #-adsh_path_var command.
The range that begins following the dollar sign ($) and ends with the first character that is not an alphanumeric character (a letter if the leading character is a letter) or an underscore (_) is treated as a shell variable name. If there is no shell variable name, the dollar sign ($) alone is not enclosed in double quotation marks (").
-
Range from ${ to }
Also includes shell variables that are not specified by the #-adsh_path_var command.
-
Separators used in path conversion rule 2
The following table lists the separators used in path conversion rule 2 and the positions at which these separators are valid or invalid:
Separator |
Separator position |
||||||
---|---|---|---|---|---|---|---|
Within ' ' |
Within " "#1 |
Within ` `#1 |
Single character following \ |
Within $( )#1 |
Within ${ }#1 |
Other |
|
| |
N |
N |
Y |
N |
Y |
#2 |
Y |
& |
N |
N |
Y |
N |
Y |
#2 |
Y |
; |
N |
N |
Y |
N |
Y |
#2 |
Y |
< |
N |
N |
Y |
N |
Y |
#2 |
Y |
> |
N |
N |
Y |
N |
Y |
#2 |
Y |
( |
N |
#3 |
Y |
N |
Y |
#2 |
Y |
) |
N |
N |
Y |
N |
Y |
#2 |
Y |
` |
N |
Y |
Y |
N |
Y |
#2 |
Y |
' |
Y |
N |
Y |
N |
Y |
#2 |
Y |
" |
N |
Y |
Y |
N |
Y |
#2 |
Y |
# |
N |
N |
Y |
N |
Y |
#2 |
Y |
= |
N |
N |
Y |
N |
Y |
#2 |
Y |
Space (including the tab symbol) |
N |
N |
Y |
N |
Y |
#2 |
Y |
Linefeed code |
N |
N |
Y |
N |
Y |
#2 |
Y |
Range |
Ranges to be nested |
|||||
---|---|---|---|---|---|---|
' ' |
" " |
` ` |
Single character following \ |
$( ) |
${ } |
|
Within " " |
N |
N |
Y |
Y |
Y |
Y |
Within ' ' |
Y |
Y |
N |
Y |
Y |
Y |
Within $( ) |
Y |
Y |
Y |
Y |
Y |
Y |
Within ${ } |
Y |
Y |
Y |
Y |
Y |
Y |
Notes
-
If this parameter is defined in both the system environment file and the job environment file, the definition in the job environment file takes effect.
-
Because path conversion rule 2 has a wider conversion range than path conversion rule 1, selecting path conversion rule 2 might not produce the expected conversion results. Before executing a job definition script, use the syntax check function to check the path conversion results in the generated script image. If there are conversion results that are not appropriate, switch the path conversion rule or modify and re-execute the job definition script.
-
When path conversion rule 2 is selected, variables to be substituted and patterns are not subject to conversion. An example follows.
Environment setting parameters:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf PATH_CONV_RULE 2 #-adsh_conf PATH_CONV /tmp d:\\temp
Job definition script before conversion:
#-adsh_path_var DIR AA=${DIR:-/tmp}
Job definition script after conversion:
#-adsh_path_var DIR AA="${DIR:-/tmp}"
In this example, because a variable is defined by the #-adsh_path_var command, the part ${variable-name} is enclosed in double quotation marks (") but /tmp is not converted. To avoid this problem, modify the job definition script by, for example, specifying /tmp as a variable, as follows:
#-adsh_path_var DIR BB=/tmp AA=${DIR:-$BB}
-
Path conversion rule 2 uses character string substitution to convert path names. Consequently, the same conversion result might not be obtained even when the same path is specified if the specified character string is different.
-
Because path conversion rule 2 also converts the document portion of a here document, make sure that programs are not converted into unprocessable data. You can take the following steps:
-
Modify the conversion rule.
-
Make sure paths are not converted using variable substitution.
If these methods do not work, switch to path conversion rule 1 or consider making the here document an external file.
The following shows an example of here document conversion.
Environment setting parameters:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf PATH_CONV_RULE 2 #-adsh_conf PATH_CONV /home/user001 d:\\home\\user001
Job definition script before conversion:
uap << EOF IN=/home/user001/infile FTP=/home/user001/ftp/outfile EOF
Job definition script after conversion:
uap << EOF IN="d:\\home\\user001"\\infile FTP="d:\\home\\user001"\\ftp\\outfile EOF
As a result, the data in the here document is converted as follows:
IN="d:\\home\\user001"\\infile FTP="d:\\home\\user001"\\ftp\\outfile
Because the post-conversion path is enclosed in double quotation marks ("), the user program will not run correctly if it cannot properly process double quotation marks ("). In some cases, it might be desirable not to convert the path name, such as when the ftp command is used to specify a path at a remote site. In this case, make a change, such as substituting a variable for the path name portion and moving it outside the here document.
For example, if you want to convert the path IN=/home/user001/infile but do not want to convert the path FTP=/home/user001/ftp/outfile, you can make the following changes:
VARIN=/home/user001/infile VARFTP='/home/user001/ftp/outfile' uap << EOF IN=$VARIN FTP=$VARFTP EOF
-
-
Note that the following characters will be converted if they satisfy the path conversion rule:
-
Operators
-
Command option characters that begin with a forward slash (/)
-
Data containing a directory separator that is not a path name, specified for a command argument
-
Ternary operator
In the following example, a ternary operator is converted.
Environment setting parameters:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf PATH_CONV_RULE 2 #-adsh_conf PATH_CONV A2/A1 A2\\A1
Job definition script before conversion:
#-adsh_job JOB001 A1=10 A2=5 ((BB=A1>A2?A1/A2:A2/A1))
Job definition script after conversion:
#-adsh_job JOB001 A1=10 A2=5 ((BB=A1>A2?A1\\A2";""A2\\A1"))
In this example, the last A2/A1 in ((BB=A1>A2?A1/A2:A2/A1)) satisfies the conversion rule and is converted. To prevent this, modify the job definition script by using one of the following methods.
Specify the variable in $shell-variable-name format:
((BB=$A1>$A2?$A1/$A2:$A2/$A1))
Rewrite the script using an if statement:
if((A1>A2)) then ((BB=$A1/$A2)) else ((BB=$A2/$A1)) fi
-
-
According to path conversion rule 2, if a character string satisfying the conversion rule contains a column name in ${column-name[*]} format, it is enclosed in double quotation marks ("). Note also that "${column-name[*]}", which is the conversion result, might appear differently after conversion because its individual elements are separated by the value of the IFS shell variable.
-
According to path conversion rule 2, a path not containing a directory separator, such as cd work, cannot be converted. In this case, modify the description of the job definition script or do not specify conversion that changes the directory name.
-
According to path conversion rule 2, when specifying a path name as an option value, as in command -p path-name, use a space to separate the option character from the path name.
-
According to path conversion rule 2, even if you convert a path contained in a command by using command substitution in the grave accent (`) format, the expected action will not occur. An example follows.
Environment setting parameters:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf PATH_CONV_RULE 2 #-adsh_conf PATH_CONV /home/user001 d:\\home\\user001
Job definition script before conversion:
cat file | grep `cat /home/user001/text`
Job definition script after conversion:
cat file | grep `cat "d:\\home\\user001"\\text`
In this example, because \ used in the command for command substitution is processed as a meta character, \\ is erased in the end, and as a result the expected action does not occur.
In this case, change to command substitution in the $() format, as shown in the following:
cat file | grep $(cat /home/user001/text)
-
According to path conversion rule 2, if you want to change /dev/null to Windows NUL device, use the COMMAND_CONV_ARG and PATH_CONV_ACCESS parameters.
-
According to path conversion rule 2, if you describe a path as shown below, it cannot be converted correctly.
Environment setting parameters:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf PATH_CONV_RULE 2
Example of a script before conversion:
#-adsh_path_var homedir INPUT1=${homedir}"/test/data" INPUT2="${homedir}"/test/data
A path is converted in units of character strings separated by separators. Therefore, even if ${homedir}/test/data is a path name, ${homedir} and /test/data are converted separately as two character strings because of the double quotation marks ("), and the following expected conversion result is not obtained.
Expected conversion result:
#-adsh_path_var homedir INPUT1="${homedir}""\\test\\data" INPUT2="${homedir}"\\test\\data
Actual conversion result:
#-adsh_path_var homedir INPUT1="${homedir}""/test/data" INPUT2="${homedir}"/test/data
In this case, modify the description as follows:
#-adsh_path_var homedir INPUT1="${homedir}/test/data" INPUT2="${homedir}/test/data"
Example
Parameter-setting examples are described below. For a job definition script conversion example, see 2.6.2 Converting path names.
-
Path conversion rule 1 is used to convert paths:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf PATH_CONV_RULE 1 #-adsh_conf PATH_CONV /home/user001 d:\\home\\user001
-
Path conversion rule 2 is used to convert paths:
#-adsh_conf PATH_CONV_ENABLE / : #-adsh_conf PATH_CONV_RULE 2 #-adsh_conf PATH_CONV /home/user01 d:\\home\\user01 #-adsh_conf PATH_CONV BB/AA BB\\AA