Hitachi

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


10.3.1 getArrayIndex (gets an index based on the value of array)

Syntax

getArrayIndex  [-d element-number]  array-name  character-string

Description

This command searches for the character string from the array specified for argument and returns the index of the first fully matched array. This command searches for elements from the 0th element in the array sequentially.

Arguments

-d element-number

This command searches for the character string from the two-dimensional array corresponding to the specified element number.

array-name

Specify the name of array from which index is obtained.

character-string

This command specifies the character string to be searched.

Output to the standard output

Character string that indicates index.

Return codes

Return code

Meaning

0

Normal termination

Not less than 1

Termination with an error

Notes

Examples

set -A input Tokyo Yokohama Fukuoka Nagoya
getArrayIndex input Tokyo          # "0" is output.
getArrayIndex input Yokohama       # "1" is output.

set -D input { Osaka Fukuoka Nagoya } { Tokyo Yokohama Chiba }
getArrayIndex -d 0 input Osaka     # "0" is output.
getArrayIndex -d 1 input Chiba     # "2" is output.