Note:

You are viewing a development version of the library. Goto the latest version.

Module OASISUtils.POSIXShell

module POSIXShell: sig .. end

val split : string -> string list
split s: the string s is interpreted as command line arguments and splitted into its components (un-escaped). For example split "a \"b c\" d" = ["a"; "b c"; "d"]. Note that split "" = []. It is possible that substitutions such as "$a" (resp. "$(a b)") may be transformed into "${a}" (resp. "${a b}").
val escape : string -> string
escape s quote s if needed to protect spaces, '"' and '\'' so it reads as a single argument in a POSIX shell command, the content of which is identical to s (interpreted with OCaml conventions). If quoted, the returned string will start and end with '"'. The original string s is returned if no quoting is necessary.
val unescape : string -> string
unescape s returns a string s' removing all backslashes preceding a char.