Module Shell.Files (.ml)


module Files: sig .. end
Wrappers operating on filexpr and providing as result a text (string list).

val glob : ?null:bool -> Shell.filexpr -> string list
Expand a file expression (with meta-characters) into the list of existing files. The optional parameter null refers to the nullglob bash option. By default null=false.

# Files.glob "/etc/*tab";;
  : string list = ["/etc/crontab"; "/etc/fstab"; "/etc/inittab"; "/etc/mtab"]


The following functions are wrappers of the homonymous unix command. The difference from the Shell versions is that they ignore their input and take a filexpr as unique argument.
val cat : ?opt:string -> Shell.filexpr -> string list
Wrapper for the cat unix filter. Examples:
# wc (Files.cat "/etc/*tab");;
  : int = 1418

# wc (Files.cat ~opt:"-n" "/etc/*tab");;
  : int = 1691

val cut : ?opt:string -> Shell.filexpr -> string list
val head : ?opt:string -> Shell.filexpr -> string list
val nl : ?opt:string -> Shell.filexpr -> string list
val sort : ?opt:string -> Shell.filexpr -> string list
val tac : ?opt:string -> Shell.filexpr -> string list
val tail : ?opt:string -> Shell.filexpr -> string list
val uniq : ?opt:string -> Shell.filexpr -> string list