Multiple choice technology operating systems

output=1;echo "2+3"|bc|read output | echo $output What is the output ?

  1. 1

  2. 5

  3. 0

  4. a Blank line

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The key is that pipeline commands run in subshells. The 'read output | echo $output' part runs in a subshell where output=5, but this doesn't affect the parent shell where output=1. The final 'echo $output' is in the parent shell, so it prints 1. The pipe from echo $output goes nowhere (read already consumed its input), so output is just '1'.