- Loading...
...
This global object is used to store the latest standard output (stdout) of the process spawned by $EXEC. For example, the result of $EXEC() is saved to $OUT.
...
This global object is used to store the latest standard error (stderr) of the process spawned by $EXEC.
$EXIT (-scripting mode only)
This global object is used to store the exit code of the process spawned by $EXEC. If the exit code is not zero, then the process failed.
| Code Block | ||
|---|---|---|
| ||
var Arrays = Java.type("java.util.Arrays") // use curl to download JSON weather data from the net var str = `curl http://api.openweathermap.org/data/2.5/forecast/daily?q=Chennai&mode=json&units=metric&cnt=7` // parse JSON var weather = JSON.parse($OUT) // pull out humidity as array var humidity = weather.list.map(function(curVal) { return curVal.humidity }) // Stream API to print stat print("Humidity") print(Arrays["stream(int[])"](humidity).summaryStatistics()) // pull maximum day time temperature var temp = weather.list.map(function(curVal) { return curVal.temp.max }) // Stream API to print stat print("Max Temperature") print(Arrays["stream(double[])"](temp).summaryStatistics()) |
$OPTIONS (-scripting mode only)
...