Issue
Is there a way in OCaml to retrieve all available environment variables?
The OCaml stdlib provides the following in the Sys
module:
val getenv : string -> string
But it only show if an env var is available. Is there a way to list all variables in the environment?
Solution
You need to use Unix.environment
from the unix
library (distributed with the OCaml system). Example:
> ocaml unix.cma
OCaml version 4.03.0
# Unix.environment ();;
- : string array = ...
Answered By - Daniel Bünzli Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.