Dav*_*idS 4 linux shell environment-variables
问题:Linux 下环境变量 PWD 的定义是否始终独立于命令 shell(忽略非命令 shell)?换句话说,像“ls $PWD”这样的命令总是会运行吗?
Posix 兼容的 shell 将设置此环境变量。在http://pubs.opengroup.org/onlinepubs/009604599/utilities/cd.html中查找 PWD
PWD 该变量应按照描述中的规定进行设置。如果应用程序设置或取消设置 PWD 的值,则 cd 的行为是未指定的。
或http://pubs.opengroup.org/onlinepubs/009604599/utilities/xcu_chap02.html中的第 2.5.3 节“Shell 变量”
变量应从环境中初始化...如果变量是从环境中初始化的,则应立即将其标记为导出
PWD 由 shell 设置为当前工作目录的绝对路径名,