Question 150
In a Linux Essentials v1.6 practice lab, the learner observes: A beginner uses a hard-coded /home/alice directory in a shared shell script and it fails for another account with a different home path. Which observed result would best verify the correction?
Explanation
Correct Answer
This specifically verifies tilde expansion returns user home directory: The command locates each signed-in user's own home directory without editing the script to insert their username. The related engineering correction is: Use a supported tilde-based home path or the HOME variable appropriately when constructing a personal file location. Evidence from another workflow would not establish the stated outcome.
Incorrect Answers
The prior harmless command appears in the history list and can be reviewed before being repeated. “Use the built-in history display or an approved history navigation shortcut to locate and selectively rerun the intended command” would remedy that alternative situation, but it would not correct the present issue: the command locates each signed-in user's own home directory without editing the script to insert their username.
“Run ls -l against the intended path and read the file type and permission character groups correctly” is the supported response when the output shows a directory beginning with d and a regular file beginning with - along with their respective ownership and mode bits. Here the decisive response is “Use a supported tilde-based home path or the HOME variable appropriately when constructing a personal file location”, so that different intervention does not meet the stated requirement.
The .profile entry appears in the listing without renaming, recreating or modifying the original file. “Use ls -a in the relevant directory to include hidden files and directories while inspecting configuration” applies to that other condition. The reported evidence is a beginner uses a hard-coded /home/alice directory in a shared shell script and it fails for another account with a different home path; this alternative would address the wrong dependency.