UNIX for OpenVMS Users, Third Edition

10.6: File Operators

10.6 File Operators

Table 10.5 lists C and Korn shell operators that test the characteristics of a file. Perl liberally borrows this syntax from both shells and adds a few operators of its own. There is no analog to these file operators in OpenVMS, although you can use values returned by the F$FILE_ATTRIBUTES lexical function to determine the attributes of an OpenVMS file. The features returned by F$FILE_ATTRIBUTES do not translate into UNIX file operators because of the different ways in which OpenVMS and UNIX treat files. An OpenVMS file is highly structured, and F$FILE_ATTRIBUTES returns information about that structure. A UNIX file is nothing more than a string of bytes. Since a UNIX file has no file structure information, file operators only return features like file ownership and permissions.

Table 10.5: File Comparison Operators

C Shell Operator

Perl

Bash and Korn Shell Operator

OpenVMS Equivalent

UNIX Meaning

-a

[*] [ ]

True if object is any kind of file

-b

-b

True if file is a block-special file

-c

-c

True if file is a character special file

-d

-d

-d

True if file is a directory

-e

-e

-e

[*] [ ]

True if file exists

-f

-f

-f

True if file is a regular file

-T

True if file is "text"

-B

True if file is "binary"

-s

F$FILE_ATTRIBUTES (,"EOF")

If file exists and is not empty, returns size in...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: High Speed Cameras
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.