Hitachi

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


10.3.29 isNormalFile (evaluates existence of a regular file)

Syntax

isNormalFile  file-path-name

Description

This command verifies whether the regular file specified for argument exists. Directory is not considered not to be file.

This command outputs 1 in the following cases:

This command outputs 0.

Arguments

file-path-name

This command specifies the path name of the file 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 the regular file log.txt exists and the regular file tmp.txt does not exist:
isNormalFile log.txt      # "1" is output.
isNormalFile tmp.txt      # "0" is output.

If the directory test exists and directory prog does not exist:
isNormalFile test          # "0" is output.
isNormalFile prog          # "0" is output.

# If the regular file file1 does not exist, create file1.
result=$(isNormalFile file1)
if [[ $result -eq 0 ]]; then
  touch file1
fi