Hitachi

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


10.3.27 isEmptyDir (evaluates existence of contents of directory)

Syntax

isEmptyDir  directory-path-name

Description

This command verifies whether the file specified for argument is empty.

This command outputs 1 in the following cases:

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

Arguments

directory-path-name

This command specifies the path name of the directory to be evaluated.

Output to the standard output

1 or 0.

Return codes

Return code

Meaning

0

Normal termination

Not less than 1

Termination with an error

Examples

If a file exists in the directory test and nothing exists in the directory tmp:
isEmptyDir test         # "0" is output.
isEmptyDir tmp          # "1" is output.

# If the directory dir1 is empty, delete dir1.
result=$(isEmptyDir dir1)
if [[ $result -eq 1 ]]; then
  rmdir dir1
fi