printenv的man摘录
NAME
printenv - print all or part of environmentSYNOPSIS
printenv [OPTION]... [VARIABLE]...DESCRIPTION
Print the values of the specified environment VARIABLE(s). If no VARIABLE is specified, print name and value pairs for them all.-0, --null end each output line with NUL, not newline --help display this help and exit --version output version information and exit NOTE: your shell may have its own version of printenv, which usually supersedes the version described here. Please refer to your shell's doc‐ umentation for details about the options it supports.
打印环境变量时,可以指定变量的名字,如果未指定,则打印所有的环境变量
如打印POD内的所定义的所有环境变量
$ printenv
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_SERVICE_PORT=443
HOSTNAME=volume-pod
LANGUAGE=en_US:en
JAVA_HOME=/opt/java/openjdk
GPG_KEYS=A9C5DF4D22E99998D9875A5110C01C5A2F6059E7
PWD=/var/run/secrets/kubernetes.io/serviceaccount
TOMCAT_SHA512=5718b877eb2d3fb05ec0c11d0af8a2bb34766e14b915ecda8d61e92670a7a911ff08c3cb03dafe8f28f10df19172ca0681ade953ccda5363fc5b57468a47476c
TOMCAT_MAJOR=10
HOME=/root
LANG=en_US.UTF-8
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
TERM=xterm
CATALINA_HOME=/usr/local/tomcat
SHLVL=1
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
LD_LIBRARY_PATH=/usr/local/tomcat/native-jni-lib
KUBERNETES_SERVICE_HOST=10.96.0.1
LC_ALL=en_US.UTF-8
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443
PATH=/usr/local/tomcat/bin:/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
TOMCAT_VERSION=10.1.1
OLDPWD=/usr/local/tomcat
JAVA_VERSION=jdk-17.0.5+8
_=/usr/bin/printenv
指定要打印的环境变量:
$ printenv HOSTNAME KUBERNETES_PORT
volume-pod
tcp://10.96.0.1:443
标签:KUBERNETES,443,打印,PORT,usr,printenv,local,环境变量
From: https://www.cnblogs.com/cosmos-wong/p/16884494.html