Previous Topic | Table of Contents | Next Topic

File System Tests

The operand of a file system test is interpreted as a word, not an expression, and may involve wildcarding. If wildcarding produces more than one match, the test is done on the first one.

Prefix Operator
True if
-A Archive Bit Set
-C File or Directory is Compressed
-D   -d Directory
-H Hidden File or Directory
-R Read-only File or Directory
-S System File or Directory
-e File or Directory Exists
-f Ordinary File
-o Ownership (Same as Existence on a FAT file system)
-r Readable (Same as ordinary file on a NT FAT file system)
-w Writable (Not Read-only and not a directory)
-x Executable (Has a .csh, .exe, .com or .cmd extension and, if it's an .exe or a .com file, appears to be a valid binary executable.)
-z Zero-length File

Example:

if (-d $a) then
   echo $a is a directory
end



Previous Topic | Table of Contents | Next Topic

Copyright © 1988-2003 by Hamilton Laboratories. All rights reserved.