Quiz: How do you print the value of the $PWD shell variable in #Linux or #Unix? Choose one answer only.
awk 'BEGIN {print ENVIRON["PWD"]}'
cat <<<"$PWD"
echo "$PWD"
printf "%s\n" "$PWD"
Poll ended at .
cat /proc/cwd
You can not trust ENVIRONMENT
There are issues with getenv(), putenv(), and setenv(). The semantics are not consistent and can be abused.
The pwd executable inherients the ENVIRONMEMT via fork() and execve() from the parent process.
If the enviroment variables have been corrupted already, then there could be turtles.
Most code does not call chdir() so using PWD probably did not change.
But, if the software in question creates addiitonal environment variables that point to subdirectories, there could be issues, especially if there are libraries involved that have not been vetted via source code review.