ContextAs Linux system administrator I sometimes need to use pipes. A simple example:
$ echo "some content text" | mail -s "this is" firstname.lastname@example.orgI 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 email@example.com";; Pervasives.output_string buf "eeeeeeeeehol";; Pervasives.flush buf;; Unix.close_process_out buf;;And you're done!