Question 70
The engineer proposes this implementation: Assign stamp=$(date +%Y%m%d) in the script. The requirement is: A nightly job should capture the output of date as a value without creating a temporary file. Which technical explanation best supports the proposed action?
Explanation
Correct Answer
Command substitution executes date and substitutes captured standard output into the assignment. It specifically supports the proposed action of Assign stamp=$(date +%Y%m%d) in the script. for the requirement described.
Incorrect Answers
This explains another Linux operation, namely Use primary-command || fallback-command with defined exit statuses., where The || operator evaluates its right-hand command only after a nonzero status on the left. It does not explain why Assign stamp=$(date +%Y%m%d) in the script. satisfies the stated condition.
This explains another Linux operation, namely Run exec /path/to/program in the script at the handoff point., where The exec builtin replaces the shell process rather than spawning a shell child that later waits. It does not explain why Assign stamp=$(date +%Y%m%d) in the script. satisfies the stated condition.
This explains another Linux operation, namely Iterate using for path in "${files[@]}"; do ...; done., where Quoted array expansion preserves element boundaries; unquoted word splitting can break file names containing spaces. It does not explain why Assign stamp=$(date +%Y%m%d) in the script. satisfies the stated condition.






LPI Level 1 (102-500) Practice Tests