cert
cert-1
cert-2

Pass LPI 102-500 Exam in First Attempt Guaranteed!

Get 100% Latest Exam Questions, Accurate & Verified Answers to Pass the Actual Exam!
30 Days Free Updates, Instant Download!

cert-5
cert-6
102-500 Exam - Verified By Experts
102-500 Premium Bundle
$29.98

102-500 Premium Bundle

$79.99
$109.97
  • Premium File 120 Questions & Answers. Last update: Nov 13, 2026
  • Training Course 126 Video Lectures
  • Study Guide 962 Pages
 
$109.97
$79.99
accept 15 downloads in last 7 days
block-screenshots
Purchase LPI 102-500 Exam Training Products Individually
LPI 102-500 Premium File
Premium File 120 Q&A
$76.99$69.99
LPI 102-500 Video Training Course
Training Course 126 Lectures
$21.99 $19.99
LPI 102-500 PDF Study Guide
Study Guide 962 Pages
$21.99 $19.99
LPI 102-500 Practice Test 2

Question 10

A helpdesk escalation describes this Linux behavior: An interactive non-login Bash session lacks an alias added only to a user's .bash_profile and a shell opens without the expected shortcut. Which TWO complementary steps provide the best corrective action and its most direct diagnostic verification? Select TWO answers.

  1. Use IFS= read -r within an appropriately redirected loop to preserve literal input and design variable state without relying on a pipeline subshell.
  2. Put login-specific exports in the appropriate user login profile and interactive aliases in ~/.bashrc, sourcing the interactive configuration from the login profile when desired.
  3. Inspect the first line, file mode, file type and any shell syntax errors, then execute in a controlled test account using the expected invocation.
  4. Assume every Bash process automatically reads ~/.bashrc and ~/.bash_profile in the same order regardless of login and interactivity.
  5. Check the shell invocation mode, inspect /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile and ~/.bashrc, and compare command resolution in fresh login and non-login sessions.

Explanation

Correct Answers

B:

Recommended administrative action: Put login-specific exports in the appropriate user login profile and interactive aliases in ~/.bashrc, sourcing the interactive configuration from the login profile when desired. bash_profile and a shell opens without the expected shortcut. Linux principle: Bash login and interactive non-login shells read different startup files; ~/.bashrc is typically for interactive non-login behavior, while login startup uses a preferred profile file.

E:

Most direct verification evidence: Check the shell invocation mode, inspect /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile and ~/.bashrc, and compare command resolution in fresh login and non-login sessions. bash_profile and a shell opens without the expected shortcut. Linux principle: Bash login and interactive non-login shells read different startup files; ~/.bashrc is typically for interactive non-login behavior, while login startup uses a preferred profile file.

Incorrect Answers

A:

That option would use IFS= read -r within an appropriately redirected loop to preserve literal input and design variable state without relying on a pipeline subshell, but it addresses a different concern. Bash login and interactive non-login shells read different startup files; ~/.bashrc is typically for interactive non-login behavior, while login startup uses a preferred profile file.

C:

That option would inspect the first line, file mode, file type and any shell syntax errors, then execute in a controlled test account using the expected invocation, but it addresses a different concern. Bash login and interactive non-login shells read different startup files; ~/.bashrc is typically for interactive non-login behavior, while login startup uses a preferred profile file.

D:

This shortcut is unsafe for the present Linux issue: Assume every Bash process automatically reads ~/.bashrc and ~/.bash_profile in the same order regardless of login and interactivity. bash_profile and a shell opens without the expected shortcut. Bash login and interactive non-login shells read different startup files; ~/.bashrc is typically for interactive non-login behavior, while login startup uses a preferred profile file.

Question 11

An operations handoff identifies this problem: An administrator adds /opt/tools to PATH but places an empty directory element ahead of trusted system commands and a shell runs a local lookalike binary. Which administrative step is the MOST appropriate way to resolve this issue? Select ONE best answer.

  1. Define and export or source an appropriate Bash function when reusable parameterized behavior is needed; use aliases for simple interactive substitutions and verify command lookup.
  2. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  3. Use IFS= read -r within an appropriately redirected loop to preserve literal input and design variable state without relying on a pipeline subshell.
  4. Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes.

Explanation

Correct Answer

D:

Recommended administrative action: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes.

Incorrect Answers

A:

That option would define and export or source an appropriate Bash function when reusable parameterized behavior is needed; use aliases for simple interactive substitutions and verify command lookup, but it addresses a different concern. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

B:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. It cannot establish a safe correction. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

C:

That option would use IFS= read -r within an appropriately redirected loop to preserve literal input and design variable state without relying on a pipeline subshell, but it addresses a different concern. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Question 12

A team maintaining a Linux host reports: An administrator adds /opt/tools to PATH but places an empty directory element ahead of trusted system commands and a shell runs a local lookalike binary. Which Linux behavior or technical principle BEST explains why the issue occurs? Select ONE best answer.

  1. Unquoted expansions undergo field splitting and pathname expansion; command output is not a safe universal list of filenames containing arbitrary characters.
  2. In Bourne-style shells an exit status of zero signals success, while && and || short-circuit on the preceding command-list status rather than on an unrelated later line.
  3. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  4. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Explanation

Correct Answer

D:

Relevant Linux operating principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Incorrect Answers

A:

This alternative addresses Quoting expansions in file-processing loops, not the specific issue of Safe PATH changes and environment export: Unquoted expansions undergo field splitting and pathname expansion; command output is not a safe universal list of filenames containing arbitrary characters. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

B:

This alternative addresses Shell exit status and AND OR command lists, not the specific issue of Safe PATH changes and environment export: In Bourne-style shells an exit status of zero signals success, while && and || short-circuit on the preceding command-list status rather than on an unrelated later line. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

C:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Question 13

While verifying a Linux change request, an engineer finds: An administrator adds /opt/tools to PATH but places an empty directory element ahead of trusted system commands and a shell runs a local lookalike binary. Which evidence or command result MOST directly tests the suspected root cause? Select ONE best answer.

  1. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  2. Check the shell invocation mode, inspect /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile and ~/.bashrc, and compare command resolution in fresh login and non-login sessions.
  3. Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables.
  4. Feed literal backslashes and spaced lines through a test input, compare the resulting strings, and inspect whether a pipeline created a subshell.

Explanation

Correct Answer

C:

Most direct verification evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables.

Incorrect Answers

A:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

B:

That option would check the shell invocation mode, inspect /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile and ~/.bashrc, and compare command resolution in fresh login and non-login sessions, but it addresses a different concern. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

D:

This alternative addresses Reading input line by line and preserving backslashes, not the specific issue of Safe PATH changes and environment export: Feed literal backslashes and spaced lines through a test input, compare the resulting strings, and inspect whether a pipeline created a subshell. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

Question 14

A Linux administrator investigates the following system incident: An administrator adds /opt/tools to PATH but places an empty directory element ahead of trusted system commands and a shell runs a local lookalike binary. Which observed outcome BEST confirms a successful and properly scoped correction? Select ONE best answer.

  1. The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.
  2. Each input record retains intended characters and the final aggregation is available in the process where it is needed.
  3. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  4. Each intended file is processed exactly once with its literal name preserved and no unintended neighbor files are changed.

Explanation

Correct Answer

A:

Observable acceptance criterion: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

Incorrect Answers

B:

This alternative addresses Reading input line by line and preserving backslashes, not the specific issue of Safe PATH changes and environment export: Each input record retains intended characters and the final aggregation is available in the process where it is needed. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

C:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. It cannot establish a safe correction. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

D:

This alternative addresses Quoting expansions in file-processing loops, not the specific issue of Safe PATH changes and environment export: Each intended file is processed exactly once with its literal name preserved and no unintended neighbor files are changed. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

Question 15

On a production Linux workstation or server, a technician observes: An administrator adds /opt/tools to PATH but places an empty directory element ahead of trusted system commands and a shell runs a local lookalike binary. Which misleading assumption MOST directly contributes to this failure and should be rejected? Select ONE best answer.

  1. Assume ordinary `read` always preserves backslashes and whitespace and that variables modified in any piped loop persist in the parent shell.
  2. Assume every script ending in .sh is run by Bash automatically and that readable script files are always executable using ./script.sh.
  3. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  4. Treat an alias as an executable application that always accepts positional parameters in scripts without loading the relevant shell definitions.

Explanation

Correct Answer

C:

Reject this specific misconception: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. It incorrectly assumes behavior that conflicts with the observed Linux conditions.

Incorrect Answers

A:

That option would assume ordinary `read` always preserves backslashes and whitespace and that variables modified in any piped loop persist in the parent shell, but it addresses a different concern. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

B:

That option would assume every script ending in .sh is run by Bash automatically and that readable script files are always executable using ./script.sh, but it addresses a different concern. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

D:

That option would treat an alias as an executable application that always accepts positional parameters in scripts without loading the relevant shell definitions, but it addresses a different concern. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Question 16

During an LPIC-1 practice lab, the operator encounters this condition: A script exports a new variable in a child shell, yet the parent interactive session cannot see the change after that script exits. Which administrative step is the MOST appropriate way to resolve this issue? Select ONE best answer.

  1. Use source or the dot command to evaluate trusted configuration in the current shell, and use unset to remove the variable or function definition when required.
  2. Use safe quoting of parameter expansions and handle filename iteration without parsing ls output, using robust globbing or null-delimited input where appropriate.
  3. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  4. Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes.

Explanation

Correct Answer

D:

Recommended administrative action: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Incorrect Answers

A:

This alternative addresses Sourcing shell settings and removing variables, not the specific issue of Safe PATH changes and environment export: Use source or the dot command to evaluate trusted configuration in the current shell, and use unset to remove the variable or function definition when required. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

B:

That option would use safe quoting of parameter expansions and handle filename iteration without parsing ls output, using robust globbing or null-delimited input where appropriate, but it addresses a different concern. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

C:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. It cannot establish a safe correction. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

Question 17

A helpdesk escalation describes this Linux behavior: A script exports a new variable in a child shell, yet the parent interactive session cannot see the change after that script exits. Which Linux behavior or technical principle BEST explains why the issue occurs? Select ONE best answer.

  1. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  2. Command substitution inserts command standard output, while test operators distinguish numeric and string comparisons and missing unquoted variables can corrupt argument counts.
  3. Sourcing executes shell statements in the current process, whereas launching a new process isolates its environment; an empty variable still exists until removed.
  4. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Explanation

Correct Answer

D:

Relevant Linux operating principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Incorrect Answers

A:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

B:

This alternative addresses Command substitution tests and numeric conditions, not the specific issue of Safe PATH changes and environment export: Command substitution inserts command standard output, while test operators distinguish numeric and string comparisons and missing unquoted variables can corrupt argument counts. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

C:

This alternative addresses Sourcing shell settings and removing variables, not the specific issue of Safe PATH changes and environment export: Sourcing executes shell statements in the current process, whereas launching a new process isolates its environment; an empty variable still exists until removed. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

Question 18

An operations handoff identifies this problem: A script exports a new variable in a child shell, yet the parent interactive session cannot see the change after that script exits. Which evidence or command result MOST directly tests the suspected root cause? Select ONE best answer.

  1. Run controlled success and failure commands, display or capture $?, inspect && and || order, and observe which branch actually executes.
  2. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  3. Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables.
  4. Feed literal backslashes and spaced lines through a test input, compare the resulting strings, and inspect whether a pipeline created a subshell.

Explanation

Correct Answer

C:

Most direct verification evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Incorrect Answers

A:

That option would run controlled success and failure commands, display or capture $?, inspect && and || order, and observe which branch actually executes, but it addresses a different concern. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

B:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. It cannot establish a safe correction. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

D:

This alternative addresses Reading input line by line and preserving backslashes, not the specific issue of Safe PATH changes and environment export: Feed literal backslashes and spaced lines through a test input, compare the resulting strings, and inspect whether a pipeline created a subshell. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

Question 19

A team maintaining a Linux host reports: A script exports a new variable in a child shell, yet the parent interactive session cannot see the change after that script exits. Which observed outcome BEST confirms a successful and properly scoped correction? Select ONE best answer.

  1. Parameterized helper calls behave correctly for supplied arguments and any script does not depend on an uninitialized interactive alias.
  2. Each input record retains intended characters and the final aggregation is available in the process where it is needed.
  3. The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.
  4. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.

Explanation

Correct Answer

C:

Observable acceptance criterion: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Incorrect Answers

A:

This alternative addresses Bash functions versus aliases and command lookup, not the specific issue of Safe PATH changes and environment export: Parameterized helper calls behave correctly for supplied arguments and any script does not depend on an uninitialized interactive alias. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

B:

This alternative addresses Reading input line by line and preserving backslashes, not the specific issue of Safe PATH changes and environment export: Each input record retains intended characters and the final aggregation is available in the process where it is needed. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries. Appropriate response: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Root-cause evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Independent acceptance: The intended trusted executable is resolved first and the correct variable reaches child programs without permitting an untrusted directory to shadow commands.

D:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Question 20

While verifying a Linux change request, an engineer finds: A script exports a new variable in a child shell, yet the parent interactive session cannot see the change after that script exits. Which TWO complementary steps provide the best corrective action and its most direct diagnostic verification? Select TWO answers.

  1. Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell.
  2. Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes.
  3. Use IFS= read -r within an appropriately redirected loop to preserve literal input and design variable state without relying on a pipeline subshell.
  4. Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables.
  5. Check the shell invocation mode, inspect /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile and ~/.bashrc, and compare command resolution in fresh login and non-login sessions.

Explanation

Correct Answers

B:

Recommended administrative action: Export only required variables and construct a deliberately ordered PATH using trusted absolute directories; source a file when the current shell must receive its changes. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

D:

Most direct verification evidence: Compare env and shell variable output, inspect PATH for empty or writable directories, and run type -a or command -v for the intended executables. Linux principle: Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

Incorrect Answers

A:

This shortcut is unsafe for the present Linux issue: Insert the current directory before /usr/bin for convenience and assume any variable exported by a finished child script alters the parent shell. Shell variable assignment is local until exported to children; child processes cannot ordinarily modify their parent's environment, and PATH search order determines executed binaries.

C:

This alternative addresses Reading input line by line and preserving backslashes, not the specific issue of Safe PATH changes and environment export: Use IFS= read -r within an appropriately redirected loop to preserve literal input and design variable state without relying on a pipeline subshell.

E:

This alternative addresses Bash login and interactive startup files, not the specific issue of Safe PATH changes and environment export: Check the shell invocation mode, inspect /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile and ~/.bashrc, and compare command resolution in fresh login and non-login sessions.

LPI Level 1 (102-500) Practice Tests