CompTIA
XK0-006 · Question #6
A Linux user frequently tests shell scripts located in the /home/user/scripts directory. Which of the following commands allows the user to run the program by invoking only the script name?
The correct answer is C. export PATH=$PATH:/home/user/scripts. By appending /home/user/scripts to the PATH environment variable, the user can execute scripts from that directory by simply typing the script name without specifying the full path.
System Configuration and Management
Question
A Linux user frequently tests shell scripts located in the /home/user/scripts directory. Which of the following commands allows the user to run the program by invoking only the script name?
Options
- Aexport SHELL=$SHELL=/home/user/scripts
- Bexport TERM=$TERM=/home/user/scripts
- Cexport PATH=$PATH:/home/user/scripts
- Dexport alias /home/user/scripts='/bin'
How the community answered
(26 responses)- B8% (2)
- C88% (23)
- D4% (1)
Explanation
By appending /home/user/scripts to the PATH environment variable, the user can execute scripts from that directory by simply typing the script name without specifying the full path.
Topics
#PATH variable#shell environment#script execution#export
Community Discussion
No community discussion yet for this question.