Home » LPI » 117-201 » How would you display the value of the present working directory?
Using command substitution, how would you display the value of the present working directory?
A. echo $(pwd)
B. echo pwd
C. $pwd
D. pwd | echo
Correct Answer: A
Explanation/Reference:
Explanation: The echo command can be used to display the contents of variables. The present working directory is held in the pwd variable. Echo $(pwd) will display the contents of the pwd variable. Other commands that would work are echo $ PWD and echo “$PWD”.
Reference: http://www.bolthole.com/solaris/ksh-beforeyoustart.html
Incorrect Answers:
B:Echo pwd would display the text ‘pwd’.
C:$pwd doesn’t do anything although $PWD would work.
D:pwd | echo doesn’t do anything.
Download Printable PDF. VALID exam to help you PASS.
|
|