PWD varible working in bash
When iam working with assignment problem pwd is given in small letters it wont shown any output but PWD gives present working directory .when we worked with terminal pwd is worked with small letters also but other system variables like home is not worked why
BASH Basics-of-Shell-Scripting 10-11 min 50-60 sec
If you type 'env' on your terminal you will find a list of shell environment variables such as PWD, HOME, USER etc, these inbuilt variables are used by command-line applications and shell scripts. These global variables can be set/unset by using 'export' command.
Now, when you type 'env' again you will find the value of PWD is changed to '/tmp'.
The 'pwd' in lower case is actually a command which returns the current working directory.
The answer in this link https://askubuntu.com/a/476633/101713 might interest you.
lowercase pwd, logname is a command which we can enter directly in the command shell
The uppercase PWD , LOGNAME are environment variables hence in bash script the lowercase commands pwd have to addressed as "$(pwd)" and uppercase environment variables have to be addressed as "$PWD" the bracket after "$" is taken as argument which is executed as a command and the output is returned .
meaning in the bash script you wrote the lowercase commands as env variables hence it didnt work.