I\'d like to iterate through the variables in env printing:
name: ${name} value: ${value}
Simply splitting by line break and iterating does
You can use env -0 to get a null terminated list of name=value pairs and use a for loop to iterate:
while IFS='=' read -r -d '' n v; do
printf "'%s'='%s'\n" "$n" "$v"
done < <(env -0)
Above script use process substitution, which is a BASH feature. On older shells you can use a pipeline:
env -0 | while IFS='=' read -r -d '' n v; do
printf "'%s'='%s'\n" "$n" "$v"
done