printenv

Print environment variables.

Source: src/execution/builtins.f90:3448-3499

Synopsis

printenv [name ...]

Description

With no arguments, prints all environment variables in KEY=VALUE format. With one or more names, prints only the value of each named variable (one per line). Variables that are not set are silently skipped.

Usage

# Print all environment variables
printenv

# Print specific variables
printenv HOME
# /home/user

printenv PATH SHELL
# /usr/local/bin:/usr/bin:/bin
# /usr/bin/fortsh

Comparison with Other Commands

CommandShows
printenvAll environment variables
printenv VARValue only (no name)
echo $VARVariable value (including non-exported)
export -pExported variables with declare -x prefix
envAll environment variables (external command)

Exit Status

StatusCondition
0Always succeeds

See Also

  • export - Export variables to the environment
  • declare - Declare variables with attributes
  • Variables - Variable overview