ContextAs Linux system administrator I sometimes need to use pipes. A simple example:
$ echo "some content text" | mail -s "this is" email@example.comI wondered how to do it with OCaml.
Pipe with OcamlWhat should be done:
- Open the command as an output channel
- Send what you want to that channel
let buf = Unix.open_process_out "mail -s ddd firstname.lastname@example.org";; Pervasives.output_string buf "eeeeeeeeehol";; Pervasives.flush buf;; Unix.close_process_out buf;;And you're done!