Hitachi

JP1 Version 11 JP1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide 


9.4.11 adshvarconv command (converts the value of a variable)

Syntax

adshvarconv [-o] -p shell-variable-name [shell-variable-name  ... ]
adshvarconv [-o] [-c] -b character-string-before-conversion 
                [-a character-string-after-conversion]
                shell-variable-name [shell-variable-name  ... ]
adshvarconv [-o] -i increase-of-\ shell-variable-name [shell-variable-name  ... ]

[only for Windows]
adshvarconv [-o] [-u] -e encoding-before-conversion 
                encoding-after-conversion
                shell-variable-name [shell-variable-name  ... ]

Description

This command converts the value of a variable according to the option.

Options

Function

-p

This command converts the shell variable value according to the path conversion setting.

-b, -a, -c

This command converts the character-string-before-conversion into the character-string-after-conversion for the shell variable value.

-i

This command increases the number of \ in the shell variable value by the specified number.

-e, -u

This command executes the code conversion of the shell variable value. [Only for Windows]

The description of the -o option is as follows:

-o option

Output destination

Omitted

This command updates the original shell variable value with the vale after conversion.

Specified

This command outputs the value after conversion to the standard output without changing the original shell variable value.

Arguments

-p

This command converts the value of the shell variable according to the path conversion setting (PATH_CONV_ENABLE and PATH_CONV environment setting parameters). The path is converted when executing the adshvarconv command. Therefore, when changing the value of the variable after executing the command, the value is not automatically converted. The value is not automatically converted even when the changed value is a value that matches the path conversion setting.

The behavior after converting the path is different from the conversion setting. The behavior of path conversion is as follows:

Path conversion actions

Each path separated with the path separator specified by PATH_CONV_ENABLE is converted with the PATH_CONV environment setting parameter.

Note: Although \\ is used as the separator symbol of Windows in the environment setting parameter, this command is converted by changing the number of \ from 2 to 1.

If the path is converted with the PATH_CONV environment setting parameter, the path separator and directory separator are converted into the separator of the corresponding OS.

Note: Although the separator symbol of Windows is converted into two backslashes (\\) by the normal path conversion functionality, the symbol is converted into a single backslash (\) by conversion using this command.

This command will not do anything when the path conversion functionality is disabled.

-b character-string-before-conversion [-a character-string-after-conversion]

This command converts the character-string-before-conversion into the character-string-after-conversion for the shell variable value. If you do not specify -a, character-string-before-conversion is deleted.

character-string-before-conversion ~ <Any character string>((1 to 256 bytes))

character-string-after-conversion ~ <Any character string>((1 to 256 bytes))

-c

This command executes conversion only when the path conversion functionality is available. This command will not do anything when the path conversion functionality is disabled. The path is converted unconditionally if the -c specification does not exist.

-i increase-of-\

This command increases the number of \ in the shell variable value by the specified number for each character. If you specify -i 1 and the character string before conversion is abc\def\\ghi\\\jkl, the character string after conversion becomes abc\\def\\\\ghi\\\\\\jkl.

increase-of-\ ~ <3-digit decimal number>((1 to 256))

-e encoding-before-conversion encoding-after-conversion [only for Windows]

Code conversion is executed for the value of the shell variable. variable-name

  • encoding-before-conversion ~ {SJIS | UTF8}

    SJIS: Indicates that encoding is Shift-JIS.

    UTF8: Indicates that encoding is UTF-8.

  • encoding-after-conversion ~ {SJIS | UTF8}

    SJIS: Indicates that encoding is Shift-JIS.

    UTF8: Indicates that encoding is UTF-8.

A validity check is not executed for the combination of the encoding before conversion and the encoding after conversion.

-u

If there is a code that cannot be converted when executing code conversion, the code conversion will end in an error.

When the -u option is not specified, the process continues after converting the character that cannot be converted into a "?".

-o

The value after conversion is output to the standard output. The shell variable value is not updated.

When the -o option is specified, you cannot specify multiple shell variable names. You cannot specify multiple elements with the array.

For options other than the -e option, the value of the variable before conversion is output to the standard output if the -o option exists even if conversion is not executed.

If conversion cannot be executed with the -e option, the result is not output to the standard output even if the -o option exists.

shell-variable-name ~ <Shell variable name>((1 to 256))

The shell variable that changes the value needs to be specified. For the upper limit of the length of the array, the upper limit of the character string includes the specification of the argument.

You can specify the array in the following format:

The element number of the array can be specified from 0 to 65,535.

How to specify an array

Description

array[n]

nth element

array[@]

All elements

array[*]

All elements

array[]

Same as array[0]

array[n][m]

Element of line n and column m

array[n][@]

All elements of the nth line

array[n][*]

All elements of the nth line

array[n][]

Same as array[n][0]

array[@][m]

All elements of column m

array[@][@]

All elements

array[@][*]

All elements

array[@][]

All elements

array[*][m]

All elements of column m

array[*][@]

All elements

array[*][*]

All elements

array[*][]

All elements

array[][m]

Same as array[0][m]

array[][@]

All elements

array[][*]

All elements

array[][]

Same as array[0][0]

Return codes

Return code

Meaning

0

Normal termination

1

  • There is a character that cannot be converted with -e. (When -u is specified)

  • The variable has the read-only attribute.

  • The variable has the integer-type attribute.

  • The variable name is not valid.

  • The variable name has not been specified.

  • -b does not exist while -a exists.

  • The character string lengths of the character string before conversion and the character string after conversion are not correct.

  • The value is not specified for the option requiring a value.

  • The combination of the options is wrong.

  • Multiple variables have been specified when specifying the -o option.

  • * or @ has been specified for the array element when specifying the -o option.

  • The specification of encoding with -e is invalid.

  • An invalid option has been specified.

  • A necessary option has not been specified.

  • An unexpected error has occurred.

Notes

Examples