100% Latest & Updated LPI 102-500 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!
Question 50
A build command needs a one-off LANG=C without changing the user's interactive locale or later commands. Choose THREE measures that together correct the failure, demonstrate success and reduce recurrence.
- Include filenames with whitespace and glob characters in automated script regression tests.
- Exercise the condition with 9, 10 and 12 and inspect its exit status.
- Print LANG in the build subprocess and again afterward in the parent shell.
- Use command-scoped environment overrides for reproducible automation and preserve user defaults.
- Run LANG=C followed by the intended command so the assignment is scoped to that invocation.
- Place the network probe inside a for loop with a properly bounded sequence and do/done.
Explanation
Correct Answers
C:Print LANG in the build subprocess and again afterward in the parent shell. The test is evidence-based because the underlying failure was: Exporting LANG globally to the shell would affect subsequent children, not just the single build execution.
D:Use command-scoped environment overrides for reproducible automation and preserve user defaults. Sustained checks matter because Exporting LANG globally to the shell would affect subsequent children, not just the single build execution.
E:Run LANG=C followed by the intended command so the assignment is scoped to that invocation. It corrects the mechanism identified in the scenario: Exporting LANG globally to the shell would affect subsequent children, not just the single build execution.
Incorrect Answers
A:This option assumes Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution. The reported symptoms instead call for: Run LANG=C followed by the intended command so the assignment is scoped to that invocation.
B:Exercise the condition with 9, 10 and 12 and inspect its exit status. could help with numeric comparison in sh; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Print LANG in the build subprocess and again afterward in the parent shell.
F:The test for loop over ordered sequence would be: Log each expected host ID and verify all four are tested once. The relevant acceptance check here is: Print LANG in the build subprocess and again afterward in the parent shell.
Question 51
An administrator prepends a colon to PATH and then notices commands in the current directory can be executed without a path. Which explanation most directly accounts for the failure in this environment?
- The script passes a command name as text instead of performing command substitution.
- A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter.
- An empty component in PATH can cause the current working directory to be searched in command lookup.
- A semicolon executes the next command regardless of the earlier command's exit code.
Explanation
Correct Answer
C:An empty component in PATH can cause the current working directory to be searched in command lookup. Addressing the cause requires: Remove empty PATH components and use an explicit trusted directory list instead.
Incorrect Answers
A:It would address capture command output safely rather than the present problem. The appropriate correction here is: Remove empty PATH components and use an explicit trusted directory list instead.
B:This option assumes A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter. The reported symptoms instead call for: Remove empty PATH components and use an explicit trusted directory list instead.
D:A semicolon executes the next command regardless of the earlier command's exit code. That describes a different fault. Here, An empty component in PATH can cause the current working directory to be searched in command lookup.
Question 52
An administrator prepends a colon to PATH and then notices commands in the current directory can be executed without a path. Which remedial step follows from the observed mechanism?
- Use #!/usr/bin/env bash or an approved absolute Bash path for the Bash-dependent script.
- Remove empty PATH components and use an explicit trusted directory list instead.
- Use read -r target and validate target before acting on it.
- Assign host=$(hostname -s), then quote "$host" when writing the record.
Explanation
Correct Answer
B:Remove empty PATH components and use an explicit trusted directory list instead. The change should be accepted only after this test: Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory.
Incorrect Answers
A:This belongs to interpreter line selects bash, where A /bin/sh shebang does not promise Bash extensions and direct execution follows the shebang interpreter. The current issue instead is: An empty component in PATH can cause the current working directory to be searched in command lookup.
C:Prompt text alone does not read standard input into a shell variable. That describes a different fault. Here, An empty component in PATH can cause the current working directory to be searched in command lookup.
D:Assign host=$(hostname -s), then quote "$host" when writing the record. belongs to a situation where The script passes a command name as text instead of performing command substitution. Here the evidence supports a different requirement: Remove empty PATH components and use an explicit trusted directory list instead.
Question 53
An administrator prepends a colon to PATH and then notices commands in the current directory can be executed without a path. What focused test would distinguish a real correction from a cosmetic change?
- Execute the script directly under the production launcher and verify it runs with Bash semantics.
- Test with a filename containing whitespace and confirm each file is processed once.
- Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory.
- Force a nonzero monitored result and confirm the captured value is unchanged after logging.
Explanation
Correct Answer
C:Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory. The observation confirms the diagnosis or falsifies it before declaring the incident resolved.
Incorrect Answers
A:The test for interpreter line selects bash would be: Execute the script directly under the production launcher and verify it runs with Bash semantics. The relevant acceptance check here is: Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory.
B:That choice responds to a preserve spaces in file paths failure. In this incident, An empty component in PATH can cause the current working directory to be searched in command lookup.
D:Force a nonzero monitored result and confirm the captured value is unchanged after logging. belongs to a situation where The special parameter $? reports the immediately preceding command's exit status, and echo overwrote it. Here the evidence supports a different requirement: Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory.
Question 54
An administrator prepends a colon to PATH and then notices commands in the current directory can be executed without a path. Which ongoing control would best reduce the chance of the issue returning?
- Test both branches of operational recovery scripts with controlled return codes.
- Validate PATH composition to avoid accidental execution from untrusted working directories.
- Test numeric boundaries and reject missing or nonnumeric inputs before arithmetic decisions.
- Use shell syntax checks and a controlled small fixture before rolling out looping probes.
Explanation
Correct Answer
B:Validate PATH composition to avoid accidental execution from untrusted working directories. The underlying risk is An empty component in PATH can cause the current working directory to be searched in command lookup.
Incorrect Answers
A:This belongs to conditional recovery on failure, where The fallback lacks a failure condition, so it executes on the successful path as well. The current issue instead is: An empty component in PATH can cause the current working directory to be searched in command lookup.
C:That choice responds to a numeric comparison in sh failure. In this incident, An empty component in PATH can cause the current working directory to be searched in command lookup.
D:Use shell syntax checks and a controlled small fixture before rolling out looping probes. could help with loop over ordered sequence; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory.
Question 55
An administrator prepends a colon to PATH and then notices commands in the current directory can be executed without a path. Select TWO justified actions that address this particular problem and confirm closure.
- Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory.
- Force the backup program to fail and verify the marker file is not created.
- Use read -r target and validate target before acting on it.
- Remove empty PATH components and use an explicit trusted directory list instead.
- Gate success-side effects on checked exit statuses instead of command order alone.
Explanation
Correct Answers
A:Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory. This measures the specific result of applying: Remove empty PATH components and use an explicit trusted directory list instead.
D:Remove empty PATH components and use an explicit trusted directory list instead. Unlike a broad workaround, it targets the observed cause: An empty component in PATH can cause the current working directory to be searched in command lookup.
Incorrect Answers
B:The test for successful command chaining would be: Force the backup program to fail and verify the marker file is not created. The relevant acceptance check here is: Inspect PATH for leading, trailing or adjacent colons and test command -v from a writable directory.
C:Use read -r target and validate target before acting on it. belongs to a situation where Prompt text alone does not read standard input into a shell variable. Here the evidence supports a different requirement: Remove empty PATH components and use an explicit trusted directory list instead.
E:A semicolon executes the next command regardless of the earlier command's exit code. That describes a different fault. Here, An empty component in PATH can cause the current working directory to be searched in command lookup.
Question 56
A revoked proxy value keeps appearing in newly spawned child processes after an administrator deletes one assignment line. Why does the reported configuration behave this way?
- In POSIX shell the loop body must be between do and done to repeat each operation.
- A semicolon executes the next command regardless of the earlier command's exit code.
- An already exported variable remains in the current process environment until unset or the shell is replaced.
- Shell test string comparison does not perform numeric ordering; integer flags such as -gt are needed.
Explanation
Correct Answer
C:An already exported variable remains in the current process environment until unset or the shell is replaced. The observation is consistent with this mechanism; a targeted repair would be: Unset the variable in the current shell and remove every active startup-file assignment that recreates it.
Incorrect Answers
A:The test for loop over ordered sequence would be: Log each expected host ID and verify all four are tested once. The relevant acceptance check here is: Check env in both the current shell and a fresh login shell to confirm the variable is absent.
B:A semicolon executes the next command regardless of the earlier command's exit code. belongs to a situation where A semicolon executes the next command regardless of the earlier command's exit code. Here the evidence supports a different requirement: An already exported variable remains in the current process environment until unset or the shell is replaced.
D:The test for numeric comparison in sh would be: Exercise the condition with 9, 10 and 12 and inspect its exit status. The relevant acceptance check here is: Check env in both the current shell and a fresh login shell to confirm the variable is absent.
Question 57
A revoked proxy value keeps appearing in newly spawned child processes after an administrator deletes one assignment line. What should the administrator do to correct this behavior?
- Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.
- Use primary_command followed by logical OR and the recovery action, or an explicit if ! command condition.
- Capture status=$? immediately after the monitored command before printing further output.
- Unset the variable in the current shell and remove every active startup-file assignment that recreates it.
Explanation
Correct Answer
D:Unset the variable in the current shell and remove every active startup-file assignment that recreates it. The change should be accepted only after this test: Check env in both the current shell and a fresh login shell to confirm the variable is absent.
Incorrect Answers
A:Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely. belongs to a situation where An unquoted empty expansion removes an argument from the test expression. Here the evidence supports a different requirement: Unset the variable in the current shell and remove every active startup-file assignment that recreates it.
B:It would address conditional recovery on failure rather than the present problem. The appropriate correction here is: Unset the variable in the current shell and remove every active startup-file assignment that recreates it.
C:This belongs to exit status after a failing command, where The special parameter $? reports the immediately preceding command's exit status, and echo overwrote it. The current issue instead is: An already exported variable remains in the current process environment until unset or the shell is replaced.
Question 58
A revoked proxy value keeps appearing in newly spawned child processes after an administrator deletes one assignment line. What diagnostic result would demonstrate the target behavior?
- Check env in both the current shell and a fresh login shell to confirm the variable is absent.
- Check effective identity during a controlled run and confirm unauthorized users cannot escalate.
- Force the backup program to fail and verify the marker file is not created.
- Execute the script directly under the production launcher and verify it runs with Bash semantics.
Explanation
Correct Answer
A:Check env in both the current shell and a fresh login shell to confirm the variable is absent. It verifies that the targeted action (Unset the variable in the current shell and remove every active startup-file assignment that recreates it.) achieved its intended outcome.
Incorrect Answers
B:Check effective identity during a controlled run and confirm unauthorized users cannot escalate. could help with script permissions and suid expectations; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Check env in both the current shell and a fresh login shell to confirm the variable is absent.
C:The test for successful command chaining would be: Force the backup program to fail and verify the marker file is not created. The relevant acceptance check here is: Check env in both the current shell and a fresh login shell to confirm the variable is absent.
D:It would address interpreter line selects bash rather than the present problem. The appropriate correction here is: Unset the variable in the current shell and remove every active startup-file assignment that recreates it.
Question 59
A revoked proxy value keeps appearing in newly spawned child processes after an administrator deletes one assignment line. Which practice is most useful after the immediate repair succeeds?
- Test both branches of operational recovery scripts with controlled return codes.
- Require quoting of variable expansions in portable test commands.
- Ban setuid shell-script designs in security reviews and test execution paths under least privilege.
- Audit startup scripts for duplicate environment definitions during decommissioning.
Explanation
Correct Answer
D:Audit startup scripts for duplicate environment definitions during decommissioning. It prevents repetition of the condition: An already exported variable remains in the current process environment until unset or the shell is replaced.
Incorrect Answers
A:The fallback lacks a failure condition, so it executes on the successful path as well. That describes a different fault. Here, An already exported variable remains in the current process environment until unset or the shell is replaced.
B:This option assumes An unquoted empty expansion removes an argument from the test expression. The reported symptoms instead call for: Unset the variable in the current shell and remove every active startup-file assignment that recreates it.
C:Ban setuid shell-script designs in security reviews and test execution paths under least privilege. belongs to a situation where Linux generally ignores setuid elevation on interpreter scripts because it is unsafe. Here the evidence supports a different requirement: Audit startup scripts for duplicate environment definitions during decommissioning.
Question 60
A revoked proxy value keeps appearing in newly spawned child processes after an administrator deletes one assignment line. Which THREE case-specific steps cover immediate repair, test evidence and sustained control?
- Audit startup scripts for duplicate environment definitions during decommissioning.
- Use read -r target and validate target before acting on it.
- Unset the variable in the current shell and remove every active startup-file assignment that recreates it.
- Check effective identity during a controlled run and confirm unauthorized users cannot escalate.
- Check env in both the current shell and a fresh login shell to confirm the variable is absent.
- Include filenames with whitespace and glob characters in automated script regression tests.
Explanation
Correct Answers
A:Audit startup scripts for duplicate environment definitions during decommissioning. This control detects or prevents the same mechanism before another incident.
C:Unset the variable in the current shell and remove every active startup-file assignment that recreates it. It addresses the root cause, while Audit startup scripts for duplicate environment definitions during decommissioning. reduces future recurrence.
E:Check env in both the current shell and a fresh login shell to confirm the variable is absent. The test is evidence-based because the underlying failure was: An already exported variable remains in the current process environment until unset or the shell is replaced.
Incorrect Answers
B:The test for read input instead of hardcoding would be: Provide two different test inputs and confirm the selected host changes accordingly. The relevant acceptance check here is: Check env in both the current shell and a fresh login shell to confirm the variable is absent.
D:Linux generally ignores setuid elevation on interpreter scripts because it is unsafe. That describes a different fault. Here, An already exported variable remains in the current process environment until unset or the shell is replaced.
F:Unquoted shell expansions undergo word splitting and pathname expansion after variable substitution. That describes a different fault. Here, An already exported variable remains in the current process environment until unset or the shell is replaced.
LPI Level 1 (102-500) Practice Tests