Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

what is the difference between PWD , pwd , ${PWD} , ${pwd} , $(PWD) , $(pwd)

I am using it inside docker bind mount and it giving different result.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

PWD , pwd , ${PWD} , ${pwd} , $(PWD) , $(pwd)

I assume that you are typing the above at a shell prompt.

  • PWD is the name of a non-existent command. That fails with "command not found".
  • pwd is the name of a shell builtin command. That outputs the current directory.
  • ${PWD} expands to the value of the PWD shell variable which contains the pathname of the current directory. It then attempts to execute it which fails because a directory is not executable.
  • ${pwd} expands a non-existent shell variable. That gives an empty string and is ignored.
  • $(PWD) attempts to get the output from running PWD, and run that as a command. It fails because the PWD command does not exist.
  • $(pwd) runs the existing command pwd. Then it takes the output of that and attempts to run it as a command. It fails because the output is a directory pathname, and directories are not executable.
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading