module Test: sig
.. end
Functions similar to the UNIX test(1) command.
val z : string -> bool
Test.z str
is true if str has length 0, false otherwise.
val n : string -> bool
Test.n str
is false if str has length 0, true otherwise.
val ef : string -> string -> bool
Test.ef f1 f2
is true if files f1
and f2
are the same.
val nt : string -> string -> bool
Test.nt f1 f2
is true if file f1
is newer than f2
.
val ot : string -> string -> bool
Test.ot f1 f2
is true if file f1
is older than f2
.
val b : string -> bool
Test.b file
is true if file
exists and is block special.
val c : string -> bool
Test.c file
is true if file
exists and is character special.
val d : string -> bool
Test.d file
is true if file
exists and is a directory.
val f : string -> bool
Test.f file
is true if file
exists and is a regular file.
val h : string -> bool
Test.h file
is true if file
exists and is a symbolic link.
val p : string -> bool
Test.p file
is true if file
exists and is a named pipe.
val e : string -> bool
Test.e file
is true if file
exists.
val g : string -> bool
Test.g file
is true if file
exists and is set-group-ID.
val k : string -> bool
Test.k file
is true if file
exists and has its sticky bit
set.
val s : string -> bool
Test.s file
is true if file
exists and is non-empty.
val u : string -> bool
Test.u file
is true if file
exists and is set-user-ID.
val t : int -> bool
Test.u n
is true if n
is a tty file descriptor.
val tfile : string -> bool
Test.u file
is true if file
is readable and is a tty.
val r : string -> bool
Test.r file
is true if file
exists and read permission is
granted.
val w : string -> bool
Test.w file
is true if file
exists and write permission is
granted.
val x : string -> bool
Test.x file
is true if file
exists and execute permission is
granted.
val test : ([< `And of 'a * 'a
| `Char
| `Dir
| `Equal of string
| `Execute
| `Exists
| `Link
| `Newer of string
| `NonEmpty
| `Older of string
| `Or of 'a * 'a
| `Pipe
| `Read
| `Reg
| `Sgid
| `Sticky
| `Suid
| `Tty
| `Write ]
as 'a) ->
string -> bool
Evaluate a more elaborate
UsrBin.Test
expression.
For instance, one might write
Test.test `And (`Read,`NonEmpty) file
to test whether
file
is both readable and non-empty.