Working on the command line · Question 11 of 12
The file setx.sh contains only export X=1. After ./setx.sh, echo $X in the same shell prints an empty line. Why?
1 answer is correct. Hard Created with AI
Show answer
Answer
- C The script ran in its own child process, whose variables do not flow back to the calling shell
Explanation
With source setx.sh or . setx.sh the script runs in the current shell, and X is kept.