This is a card in Dave's Virtual Box of Cards.
Ruby ENV
Created: 2022-09-28
CLI and CGI scripts need to be able to read the process environment.
Ruby makes this easy. Print them all:
p ENV
Or print one:
puts "My shell is #{ENV['SHELL']}"
Here’s how I check for a local CGI dev environment:
if ENV['LOCAL_TEST'] # Do something different in local dev environment end