1234567891011121314151617181920212223242526272829303132(* some shell commands via shell *)(* new version which can work in MinGW *)openUnixopenCommandletcomnametokens=exec(name::tokens)|>print|>void|>wait|>sndletcp=com"/bin/cp"letmv=com"/bin/mv"letrm=com"/bin/rm"letcat=com"/bin/cat"letfilepath=matchexec["/usr/bin/file";path]|>stdout|>waitwith|[],WEXITED0->OkNone|lines,WEXITED0->Ok(Some(Xlist.lastlines))|_,st->Errorstletgrepargs~init~f=exec("/bin/grep"::args)|>Command.foldfinit|>waitletgrep_xs=grepxs~init:()~f:(fun_st_->())|>sndletcmpp1p2=matchexec["/bin/cmp";p1;p2]|>void|>wait|>sndwith|WEXITED0->`Same|WEXITED1->`Different|WEXITED2->`Error|_->`Error(* something extremely wrong happened *)