Hitachi

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


10.3.2 isEmptyVar (evaluates to a null variable)

Syntax

isEmptyVar  variable-name

Description

This command evaluates whether a value of variable is substituted for variable.

If either of the following conditions is met, 1 is output:

This command outputs 0.

Arguments

variable-name

This command specifies a variable name to be determined.

If you specify the array, specify the array including element number (example: array[1]).

Output to the standard output

1 or 0.

Return codes

Return code

Meaning

0

Normal termination

Not less than 1

Termination with an error

Notes

Examples

typeset var1
isEmptyVar var1    # "1" is output.
var1=""
isEmptyVar var1    # "1" is output.
var1=100
isEmptyVar var1    # "0" is output.

#If variable var1 is null, return 1.
result=$(isEmptyVar var1)
if [[ $result -eq 1 ]]; then
  return 1
fi