Go to: Synopsis. Return value. Flags. MEL examples.
filetest [-L] [-b] [-c] [-d] [-e] [-f] [-g] [-h] [-k] [-l] [-p] [-r] [-s] [-u] [-w] [-x] [-z]
string
filetest is NOT undoable, NOT queryable, and NOT editable.
This is a file access and type checking command. It evaluates a test based on a single flag given to it and returns 1 if the value is true; otherwise, 0. Filetest also returns 0 if the test is invalid. When permissions are tested, the effective user ID of the process is used. The unary negation operator, "!", may precede the test. Special Note: If you test a file you own (the -r, -w, or -x tests), but the permission tested does not have the owner bit set, a non-zero (false) exit status will be returned even though the file may have the group or other bit set for that permission. The correct exit status will be set if you are super-user. If more than one test is specified, only the first test is executed; the others are ignored. Note:int | Test result |
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
-L(-L)
|
|
|||
|
||||
-b(-b)
|
|
|||
|
||||
-c(-c)
|
|
|||
|
||||
-d(-d)
|
|
|||
|
||||
-e(-e)
|
|
|||
|
||||
-f(-f)
|
|
|||
|
||||
-g(-g)
|
|
|||
|
||||
-h(-h)
|
|
|||
|
||||
-k(-k)
|
|
|||
|
||||
-l(-l)
|
|
|||
|
||||
-p(-p)
|
|
|||
|
||||
-r(-r)
|
|
|||
|
||||
-s(-s)
|
|
|||
|
||||
-u(-u)
|
|
|||
|
||||
-w(-w)
|
|
|||
|
||||
-x(-x)
|
|
|||
|
||||
-z(-z)
|
|
|||
|
Flag can appear in Create mode of command | Flag can appear in Edit mode of command |
Flag can appear in Query mode of command | Flag can be used more than once in a command. |
// Test whether the temp directory exists // string $tmpDir = `internalVar -userTmpDir`; filetest -d $tmpDir; // Result: 1 // // The following will fail because the temp dir is not a regular file // filetest -f $tmpDir; // Result: 0 //