100% Latest & Updated LPI 102-500 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!
Question 10
A desktop user's terminal opens Bash interactively without login mode, and aliases from ~/.bash_profile never appear. Which THREE case-specific steps cover immediate repair, test evidence and sustained control?
- Join the marker action to the backup command using && or an explicit zero-status if test.
- Keep interactive-only customizations in bashrc and test both login and non-login shells.
- Open a new ordinary terminal and use type to verify the alias is visible.
- Validate user input and handle EOF explicitly before destructive administrative operations.
- Log each expected host ID and verify all four are tested once.
- Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
Explanation
Correct Answers
B:Keep interactive-only customizations in bashrc and test both login and non-login shells. Sustained checks matter because Interactive non-login Bash reads ~/.bashrc rather than the login profile by default.
C:Open a new ordinary terminal and use type to verify the alias is visible. This measures the specific result of applying: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
F:Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed. The change should be accepted only after this test: Open a new ordinary terminal and use type to verify the alias is visible.
Incorrect Answers
A:This option assumes A semicolon executes the next command regardless of the earlier command's exit code. The reported symptoms instead call for: Place interactive aliases in ~/.bashrc and source that file from a login profile only when needed.
D:Validate user input and handle EOF explicitly before destructive administrative operations. could help with read input instead of hardcoding; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Open a new ordinary terminal and use type to verify the alias is visible.
E:Log each expected host ID and verify all four are tested once. could help with loop over ordered sequence; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Open a new ordinary terminal and use type to verify the alias is visible.
Question 11
A shell variable named REPORT_ROOT works at the prompt but a launched backup script sees it empty. Why does the reported configuration behave this way?
- In POSIX shell the loop body must be between do and done to repeat each operation.
- Shell test string comparison does not perform numeric ordering; integer flags such as -gt are needed.
- A shell-local assignment is not automatically included in the environment inherited by child processes.
- The read builtin normally treats backslashes as escapes unless -r is supplied.
Explanation
Correct Answer
C:A shell-local assignment is not automatically included in the environment inherited by child processes. Addressing the cause requires: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
Incorrect Answers
A:This option assumes In POSIX shell the loop body must be between do and done to repeat each operation. The reported symptoms instead call for: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
B:This option assumes Shell test string comparison does not perform numeric ordering; integer flags such as -gt are needed. The reported symptoms instead call for: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
D:This option assumes The read builtin normally treats backslashes as escapes unless -r is supplied. The reported symptoms instead call for: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
Question 12
A shell variable named REPORT_ROOT works at the prompt but a launched backup script sees it empty. What should the administrator do to correct this behavior?
- Quote "$file" at each use and iterate safely over properly expanded pathnames.
- Use IFS= read -r line inside a controlled while loop.
- Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
- Capture status=$? immediately after the monitored command before printing further output.
Explanation
Correct Answer
C:Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment. This is appropriate because A shell-local assignment is not automatically included in the environment inherited by child processes.
Incorrect Answers
A:That choice responds to a preserve spaces in file paths failure. In this incident, A shell-local assignment is not automatically included in the environment inherited by child processes.
B:The read builtin normally treats backslashes as escapes unless -r is supplied. That describes a different fault. Here, A shell-local assignment is not automatically included in the environment inherited by child processes.
D:It would address exit status after a failing command rather than the present problem. The appropriate correction here is: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
Question 13
A shell variable named REPORT_ROOT works at the prompt but a launched backup script sees it empty. Which check would provide the strongest evidence that the fix worked?
- Test with a filename containing whitespace and confirm each file is processed once.
- Run env in a child shell and verify REPORT_ROOT is included with the expected value.
- Log each expected host ID and verify all four are tested once.
- Run the script with the parameter empty, unset and populated to verify branching.
Explanation
Correct Answer
B:Run env in a child shell and verify REPORT_ROOT is included with the expected value. This check is tied to the expected behavior rather than mere process uptime.
Incorrect Answers
A:Test with a filename containing whitespace and confirm each file is processed once. belongs to a situation where Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution. Here the evidence supports a different requirement: Run env in a child shell and verify REPORT_ROOT is included with the expected value.
C:It would address loop over ordered sequence rather than the present problem. The appropriate correction here is: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
D:That choice responds to a avoid globbing in scalar tests failure. In this incident, A shell-local assignment is not automatically included in the environment inherited by child processes.
Question 14
A shell variable named REPORT_ROOT works at the prompt but a launched backup script sees it empty. What longer-term control best supports this requirement?
- Audit whether task variables need to be shell-local or exported to child processes.
- Require quoting of variable expansions in portable test commands.
- Place exit-status capture adjacent to the command it evaluates.
- Test both branches of operational recovery scripts with controlled return codes.
Explanation
Correct Answer
A:Audit whether task variables need to be shell-local or exported to child processes. It preserves the corrective behavior established through: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
Incorrect Answers
B:It would address avoid globbing in scalar tests rather than the present problem. The appropriate correction here is: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
C:The test for exit status after a failing command would be: Force a nonzero monitored result and confirm the captured value is unchanged after logging. The relevant acceptance check here is: Run env in a child shell and verify REPORT_ROOT is included with the expected value.
D:Test both branches of operational recovery scripts with controlled return codes. belongs to a situation where The fallback lacks a failure condition, so it executes on the successful path as well. Here the evidence supports a different requirement: Audit whether task variables need to be shell-local or exported to child processes.
Question 15
A shell variable named REPORT_ROOT works at the prompt but a launched backup script sees it empty. Which TWO options provide a coherent remediation-and-test response to this incident?
- Run env in a child shell and verify REPORT_ROOT is included with the expected value.
- Test both branches of operational recovery scripts with controlled return codes.
- Inspect the generated record and confirm it contains the evaluated short hostname.
- Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.
- Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
Explanation
Correct Answers
A:Run env in a child shell and verify REPORT_ROOT is included with the expected value. This measures the specific result of applying: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
E:Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment. Unlike a broad workaround, it targets the observed cause: A shell-local assignment is not automatically included in the environment inherited by child processes.
Incorrect Answers
B:The fallback lacks a failure condition, so it executes on the successful path as well. That describes a different fault. Here, A shell-local assignment is not automatically included in the environment inherited by child processes.
C:This belongs to capture command output safely, where The script passes a command name as text instead of performing command substitution. The current issue instead is: A shell-local assignment is not automatically included in the environment inherited by child processes.
D:It would address avoid globbing in scalar tests rather than the present problem. The appropriate correction here is: Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
Question 16
A nonprivileged user runs a custom tool named audit, but the wrong executable in an earlier PATH directory is chosen. What underlying Linux behavior should the administrator identify first?
- A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter.
- Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution.
- Command lookup follows the order of directories in PATH, not the newest version of an executable.
- In POSIX shell the loop body must be between do and done to repeat each operation.
Explanation
Correct Answer
C:Command lookup follows the order of directories in PATH, not the newest version of an executable. This is the explanation that justifies the specific remedy: Put the approved executable directory before the conflicting directory or invoke its absolute path.
Incorrect Answers
A:A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter. could help with interpreter line selects bash; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Use type -a audit and command -v audit to inspect every candidate and the selected path.
B:This belongs to preserve spaces in file paths, where Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution. The current issue instead is: Command lookup follows the order of directories in PATH, not the newest version of an executable.
D:That choice responds to a loop over ordered sequence failure. In this incident, Command lookup follows the order of directories in PATH, not the newest version of an executable.
Question 17
A nonprivileged user runs a custom tool named audit, but the wrong executable in an earlier PATH directory is chosen. What should the administrator do to correct this behavior?
- Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.
- Assign host=$(hostname -s), then quote "$host" when writing the record.
- Run narrowly scoped privileged operations through a reviewed sudo policy or a dedicated privileged service instead.
- Put the approved executable directory before the conflicting directory or invoke its absolute path.
Explanation
Correct Answer
D:Put the approved executable directory before the conflicting directory or invoke its absolute path. This is appropriate because Command lookup follows the order of directories in PATH, not the newest version of an executable.
Incorrect Answers
A:This belongs to avoid globbing in scalar tests, where An unquoted empty expansion removes an argument from the test expression. The current issue instead is: Command lookup follows the order of directories in PATH, not the newest version of an executable.
B:That choice responds to a capture command output safely failure. In this incident, Command lookup follows the order of directories in PATH, not the newest version of an executable.
C:Run narrowly scoped privileged operations through a reviewed sudo policy or a dedicated privileged service instead. could help with script permissions and suid expectations; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Use type -a audit and command -v audit to inspect every candidate and the selected path.
Question 18
A nonprivileged user runs a custom tool named audit, but the wrong executable in an earlier PATH directory is chosen. Which observation should be used for acceptance testing?
- Simulate primary success and failure separately and verify recovery runs only for failure.
- Inspect the generated record and confirm it contains the evaluated short hostname.
- Execute the script directly under the production launcher and verify it runs with Bash semantics.
- Use type -a audit and command -v audit to inspect every candidate and the selected path.
Explanation
Correct Answer
D:Use type -a audit and command -v audit to inspect every candidate and the selected path. It verifies that the targeted action (Put the approved executable directory before the conflicting directory or invoke its absolute path.) achieved its intended outcome.
Incorrect Answers
A:The test for conditional recovery on failure would be: Simulate primary success and failure separately and verify recovery runs only for failure. The relevant acceptance check here is: Use type -a audit and command -v audit to inspect every candidate and the selected path.
B:Inspect the generated record and confirm it contains the evaluated short hostname. could help with capture command output safely; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Use type -a audit and command -v audit to inspect every candidate and the selected path.
C:Execute the script directly under the production launcher and verify it runs with Bash semantics. could help with interpreter line selects bash; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Use type -a audit and command -v audit to inspect every candidate and the selected path.
Question 19
A nonprivileged user runs a custom tool named audit, but the wrong executable in an earlier PATH directory is chosen. Which ongoing control would best reduce the chance of the issue returning?
- Validate user input and handle EOF explicitly before destructive administrative operations.
- Add an example of expected expansion to the script's acceptance tests.
- Test both branches of operational recovery scripts with controlled return codes.
- Avoid untrusted writable directories ahead of system binaries in PATH.
Explanation
Correct Answer
D:Avoid untrusted writable directories ahead of system binaries in PATH. It makes the outcome of the targeted repair (Put the approved executable directory before the conflicting directory or invoke its absolute path.) repeatable.
Incorrect Answers
A:Validate user input and handle EOF explicitly before destructive administrative operations. belongs to a situation where Prompt text alone does not read standard input into a shell variable. Here the evidence supports a different requirement: Avoid untrusted writable directories ahead of system binaries in PATH.
B:It would address capture command output safely rather than the present problem. The appropriate correction here is: Put the approved executable directory before the conflicting directory or invoke its absolute path.
C:That choice responds to a conditional recovery on failure failure. In this incident, Command lookup follows the order of directories in PATH, not the newest version of an executable.
Question 20
A nonprivileged user runs a custom tool named audit, but the wrong executable in an earlier PATH directory is chosen. Select THREE measures that follow directly from the root cause and lifecycle risk.
- Use shell syntax checks and a controlled small fixture before rolling out looping probes.
- Use type -a audit and command -v audit to inspect every candidate and the selected path.
- Inspect the generated record and confirm it contains the evaluated short hostname.
- Join the marker action to the backup command using && or an explicit zero-status if test.
- Avoid untrusted writable directories ahead of system binaries in PATH.
- Put the approved executable directory before the conflicting directory or invoke its absolute path.
Explanation
Correct Answers
B:Use type -a audit and command -v audit to inspect every candidate and the selected path. This check is tied to the expected behavior rather than mere process uptime.
E:Avoid untrusted writable directories ahead of system binaries in PATH. This control detects or prevents the same mechanism before another incident.
F:Put the approved executable directory before the conflicting directory or invoke its absolute path. This is appropriate because Command lookup follows the order of directories in PATH, not the newest version of an executable.
Incorrect Answers
A:This option assumes In POSIX shell the loop body must be between do and done to repeat each operation. The reported symptoms instead call for: Put the approved executable directory before the conflicting directory or invoke its absolute path.
C:The script passes a command name as text instead of performing command substitution. That describes a different fault. Here, Command lookup follows the order of directories in PATH, not the newest version of an executable.
D:A semicolon executes the next command regardless of the earlier command's exit code. That describes a different fault. Here, Command lookup follows the order of directories in PATH, not the newest version of an executable.
LPI Level 1 (102-500) Practice Tests