LPI 102-500 Exam Dumps, Practice Test Questions

100% Latest & Updated LPI 102-500 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!

LPI 102-500 Premium Bundle
$79.97
$59.98

102-500 Premium Bundle

  • Premium File: 120 Questions & Answers. Last update: Nov 18, 2026
  • Training Course: 126 Video Lectures
  • Study Guide: 962 Pages
  • Latest Questions
  • 100% Accurate Answers
  • Fast Exam Updates

102-500 Premium Bundle

LPI 102-500 Premium Bundle
  • Premium File: 120 Questions & Answers. Last update: Nov 18, 2026
  • Training Course: 126 Video Lectures
  • Study Guide: 962 Pages
  • Latest Questions
  • 100% Accurate Answers
  • Fast Exam Updates
$79.97
$59.98

LPI 102-500 Practice Test 10

Question 90

A script reads Windows-style paths from a manifest but loses embedded backslashes in the results. Which THREE actions form a suitable remediation, verification and prevention plan? Select THREE.

  1. Use IFS= read -r line inside a controlled while loop.
  2. Document which login startup file owns environment customization and avoid conflicting definitions.
  3. Feed a manifest with spaces and literal backslashes and compare the output byte-for-byte.
  4. Standardize IFS= read -r for line-oriented scripts handling untrusted text.
  5. Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
  6. Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user.

Explanation

Correct Answers

A:

Use IFS= read -r line inside a controlled while loop. It corrects the mechanism identified in the scenario: The read builtin normally treats backslashes as escapes unless -r is supplied.

C:

Feed a manifest with spaces and literal backslashes and compare the output byte-for-byte. This check is tied to the expected behavior rather than mere process uptime.

D:

Standardize IFS= read -r for line-oriented scripts handling untrusted text. It prevents repetition of the condition: The read builtin normally treats backslashes as escapes unless -r is supplied.

Incorrect Answers

B:

Bash reads the first readable per-user login profile in its defined order, so ~/.bash_profile prevents ~/.profile from being read. That describes a different fault. Here, The read builtin normally treats backslashes as escapes unless -r is supplied.

E:

This option assumes A shell-local assignment is not automatically included in the environment inherited by child processes. The reported symptoms instead call for: Use IFS= read -r line inside a controlled while loop.

F:

The test for new account skeleton content would be: Create a test account, inspect its copied dotfiles and verify ownership belongs to the new user. The relevant acceptance check here is: Feed a manifest with spaces and literal backslashes and compare the output byte-for-byte.

Question 91

An asset inventory script writes the literal word hostname rather than the machine's actual short name. Why does the reported configuration behave this way?

  1. Bash's ~/.bash_logout is the per-user login-shell exit hook, while ~/.bashrc is an interactive startup hook.
  2. An empty component in PATH can cause the current working directory to be searched in command lookup.
  3. The script passes a command name as text instead of performing command substitution.
  4. Exporting LANG globally to the shell would affect subsequent children, not just the single build execution.

Explanation

Correct Answer

C:

The script passes a command name as text instead of performing command substitution. This is the explanation that justifies the specific remedy: Assign host=$(hostname -s), then quote "$host" when writing the record.

Incorrect Answers

A:

This option assumes Bash's ~/.bash_logout is the per-user login-shell exit hook, while ~/.bashrc is an interactive startup hook. The reported symptoms instead call for: Assign host=$(hostname -s), then quote "$host" when writing the record.

B:

An empty component in PATH can cause the current working directory to be searched in command lookup. belongs to a situation where An empty component in PATH can cause the current working directory to be searched in command lookup. Here the evidence supports a different requirement: The script passes a command name as text instead of performing command substitution.

D:

The test for one command environment override would be: Print LANG in the build subprocess and again afterward in the parent shell. The relevant acceptance check here is: Inspect the generated record and confirm it contains the evaluated short hostname.

Question 92

An asset inventory script writes the literal word hostname rather than the machine's actual short name. Which change most directly meets the stated requirement?

  1. Remove empty PATH components and use an explicit trusted directory list instead.
  2. Assign host=$(hostname -s), then quote "$host" when writing the record.
  3. Use ~/.bash_logout for appropriate per-user login-shell cleanup, with guarded path handling.
  4. Define the function in an appropriate Bash startup file; for a supported inherited child Bash, export -f can be used deliberately.

Explanation

Correct Answer

B:

Assign host=$(hostname -s), then quote "$host" when writing the record. This is appropriate because The script passes a command name as text instead of performing command substitution.

Incorrect Answers

A:

An empty component in PATH can cause the current working directory to be searched in command lookup. That describes a different fault. Here, The script passes a command name as text instead of performing command substitution.

C:

Use ~/.bash_logout for appropriate per-user login-shell cleanup, with guarded path handling. belongs to a situation where Bash's ~/.bash_logout is the per-user login-shell exit hook, while ~/.bashrc is an interactive startup hook. Here the evidence supports a different requirement: Assign host=$(hostname -s), then quote "$host" when writing the record.

D:

This belongs to function available only in parent, where A function defined in one shell is not automatically a function in an unrelated child shell. The current issue instead is: The script passes a command name as text instead of performing command substitution.

Question 93

An asset inventory script writes the literal word hostname rather than the machine's actual short name. Which test would confirm the suspected Linux mechanism?

  1. Inspect the generated record and confirm it contains the evaluated short hostname.
  2. Test fresh login shells for two different accounts and inspect the exported variable.
  3. Check env in both the current shell and a fresh login shell to confirm the variable is absent.
  4. Run env in a child shell and verify REPORT_ROOT is included with the expected value.

Explanation

Correct Answer

A:

Inspect the generated record and confirm it contains the evaluated short hostname. It verifies that the targeted action (Assign host=$(hostname -s), then quote "$host" when writing the record.) achieved its intended outcome.

Incorrect Answers

B:

Test fresh login shells for two different accounts and inspect the exported variable. could help with shared shell initialization; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Inspect the generated record and confirm it contains the evaluated short hostname.

C:

This option assumes An already exported variable remains in the current process environment until unset or the shell is replaced. The reported symptoms instead call for: Assign host=$(hostname -s), then quote "$host" when writing the record.

D:

That choice responds to a child process inherited variable failure. In this incident, The script passes a command name as text instead of performing command substitution.

Question 94

An asset inventory script writes the literal word hostname rather than the machine's actual short name. Which practice is most useful after the immediate repair succeeds?

  1. Add an example of expected expansion to the script's acceptance tests.
  2. Validate PATH composition to avoid accidental execution from untrusted working directories.
  3. Audit whether task variables need to be shell-local or exported to child processes.
  4. Use command-scoped environment overrides for reproducible automation and preserve user defaults.

Explanation

Correct Answer

A:

Add an example of expected expansion to the script's acceptance tests. The underlying risk is The script passes a command name as text instead of performing command substitution.

Incorrect Answers

B:

This belongs to inherited empty path entry, where An empty component in PATH can cause the current working directory to be searched in command lookup. The current issue instead is: The script passes a command name as text instead of performing command substitution.

C:

This belongs to child process inherited variable, where A shell-local assignment is not automatically included in the environment inherited by child processes. The current issue instead is: The script passes a command name as text instead of performing command substitution.

D:

Use command-scoped environment overrides for reproducible automation and preserve user defaults. belongs to a situation where Exporting LANG globally to the shell would affect subsequent children, not just the single build execution. Here the evidence supports a different requirement: Add an example of expected expansion to the script's acceptance tests.

Question 95

An asset inventory script writes the literal word hostname rather than the machine's actual short name. Select TWO justified actions that address this particular problem and confirm closure.

  1. Inspect the generated record and confirm it contains the evaluated short hostname.
  2. Assign host=$(hostname -s), then quote "$host" when writing the record.
  3. Export REPORT_ROOT after assigning it, or prefix the one child command with its environment assignment.
  4. Audit whether task variables need to be shell-local or exported to child processes.
  5. Use type -a audit and command -v audit to inspect every candidate and the selected path.

Explanation

Correct Answers

A:

Inspect the generated record and confirm it contains the evaluated short hostname. It distinguishes a genuine correction from a superficial edit that has not addressed the underlying cause: The script passes a command name as text instead of performing command substitution.

B:

Assign host=$(hostname -s), then quote "$host" when writing the record. The change should be accepted only after this test: Inspect the generated record and confirm it contains the evaluated short hostname.

Incorrect Answers

C:

The test for child process inherited variable would be: Run env in a child shell and verify REPORT_ROOT is included with the expected value. The relevant acceptance check here is: Inspect the generated record and confirm it contains the evaluated short hostname.

D:

Audit whether task variables need to be shell-local or exported to child processes. belongs to a situation where A shell-local assignment is not automatically included in the environment inherited by child processes. Here the evidence supports a different requirement: Add an example of expected expansion to the script's acceptance tests.

E:

This option assumes Command lookup follows the order of directories in PATH, not the newest version of an executable. The reported symptoms instead call for: Assign host=$(hostname -s), then quote "$host" when writing the record.

Question 96

An operator tests an optional shell variable without quoting it and gets a unary-operator error when it is empty. Which mechanism best explains the difference between expectation and result?

  1. Per-user Bash startup files cannot reliably configure all login users across the host.
  2. An unquoted empty expansion removes an argument from the test expression.
  3. Command lookup follows the order of directories in PATH, not the newest version of an executable.
  4. An empty component in PATH can cause the current working directory to be searched in command lookup.

Explanation

Correct Answer

B:

An unquoted empty expansion removes an argument from the test expression. This is the explanation that justifies the specific remedy: Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.

Incorrect Answers

A:

This option assumes Per-user Bash startup files cannot reliably configure all login users across the host. The reported symptoms instead call for: Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.

C:

That choice responds to a command lookup path ordering failure. In this incident, An unquoted empty expansion removes an argument from the test expression.

D:

This option assumes An empty component in PATH can cause the current working directory to be searched in command lookup. The reported symptoms instead call for: Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.

Question 97

An operator tests an optional shell variable without quoting it and gets a unary-operator error when it is empty. Which intervention addresses the specific problem with the least unrelated change?

  1. Use ~/.bash_logout for appropriate per-user login-shell cleanup, with guarded path handling.
  2. Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.
  3. Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled.
  4. Remove empty PATH components and use an explicit trusted directory list instead.

Explanation

Correct Answer

B:

Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely. It is the direct response; verify the result by: Run the script with the parameter empty, unset and populated to verify branching.

Incorrect Answers

A:

This belongs to login shell cleanup, where Bash's ~/.bash_logout is the per-user login-shell exit hook, while ~/.bashrc is an interactive startup hook. The current issue instead is: An unquoted empty expansion removes an argument from the test expression.

C:

Maintain the approved default dotfiles under /etc/skel and create a new account with home creation enabled. could help with new account skeleton content; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Run the script with the parameter empty, unset and populated to verify branching.

D:

This belongs to inherited empty path entry, where An empty component in PATH can cause the current working directory to be searched in command lookup. The current issue instead is: An unquoted empty expansion removes an argument from the test expression.

Question 98

An operator tests an optional shell variable without quoting it and gets a unary-operator error when it is empty. Which test would confirm the suspected Linux mechanism?

  1. Use type -a audit and command -v audit to inspect every candidate and the selected path.
  2. Print the variable before and after source ~/.bashrc without closing the shell.
  3. Test fresh login shells for two different accounts and inspect the exported variable.
  4. Run the script with the parameter empty, unset and populated to verify branching.

Explanation

Correct Answer

D:

Run the script with the parameter empty, unset and populated to verify branching. This check is tied to the expected behavior rather than mere process uptime.

Incorrect Answers

A:

That choice responds to a command lookup path ordering failure. In this incident, An unquoted empty expansion removes an argument from the test expression.

B:

The test for execute profile in current process would be: Print the variable before and after source ~/.bashrc without closing the shell. The relevant acceptance check here is: Run the script with the parameter empty, unset and populated to verify branching.

C:

That choice responds to a shared shell initialization failure. In this incident, An unquoted empty expansion removes an argument from the test expression.

Question 99

An operator tests an optional shell variable without quoting it and gets a unary-operator error when it is empty. What operational safeguard addresses the root cause?

  1. Maintain global login configuration centrally rather than copying account-specific dotfiles.
  2. Require quoting of variable expansions in portable test commands.
  3. Document which login startup file owns environment customization and avoid conflicting definitions.
  4. Make logout hooks idempotent and avoid destructive cleanup on shared directories.

Explanation

Correct Answer

B:

Require quoting of variable expansions in portable test commands. It preserves the corrective behavior established through: Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.

Incorrect Answers

A:

Per-user Bash startup files cannot reliably configure all login users across the host. That describes a different fault. Here, An unquoted empty expansion removes an argument from the test expression.

C:

The test for bash login profile precedence would be: Start a fresh bash login shell and inspect PATH after tracing which profile was read. The relevant acceptance check here is: Run the script with the parameter empty, unset and populated to verify branching.

D:

Make logout hooks idempotent and avoid destructive cleanup on shared directories. could help with login shell cleanup; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Run the script with the parameter empty, unset and populated to verify branching.

Question 100

An operator tests an optional shell variable without quoting it and gets a unary-operator error when it is empty. Which THREE case-specific steps cover immediate repair, test evidence and sustained control?

  1. Require quoting of variable expansions in portable test commands.
  2. Run the script with the parameter empty, unset and populated to verify branching.
  3. Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.
  4. Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement.
  5. Maintain global login configuration centrally rather than copying account-specific dotfiles.
  6. Open a new ordinary terminal and use type to verify the alias is visible.

Explanation

Correct Answers

A:

Require quoting of variable expansions in portable test commands. It preserves the corrective behavior established through: Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.

B:

Run the script with the parameter empty, unset and populated to verify branching. This measures the specific result of applying: Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely.

C:

Use [ -n "$value" ] or a Bash-native conditional that handles empty strings safely. This is appropriate because An unquoted empty expansion removes an argument from the test expression.

Incorrect Answers

D:

Put login-wide settings in /etc/profile or an applicable profile.d snippet, considering the distribution's startup arrangement. could help with shared shell initialization; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Run the script with the parameter empty, unset and populated to verify branching.

E:

That choice responds to a shared shell initialization failure. In this incident, An unquoted empty expansion removes an argument from the test expression.

F:

Open a new ordinary terminal and use type to verify the alias is visible. could help with nonlogin terminal startup; it neither resolves nor demonstrates the current requirement. The distinguishing check is: Run the script with the parameter empty, unset and populated to verify branching.

LPI Level 1 (102-500) Practice Tests

UP

SPECIAL OFFER: GET 10% OFF

This is ONE TIME OFFER

ExamSnap Discount Offer
Enter Your Email Address to Receive Your 10% Off Discount Code

A confirmation link will be sent to this email address to verify your login. *We value your privacy. We will not rent or sell your email address.

Download Free Demo of VCE Exam Simulator

Experience Avanset VCE Exam Simulator for yourself.

Simply submit your e-mail address below to get started with our interactive software demo of your free trial.

Free Demo Limits: In the demo version you will be able to access only first 5 questions from exam.