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.

Certifications & exams

Which exam comes next?

You can already practise for 51 exams, and 16 are up for a vote. See all certifications with their official information, cast your vote or suggest your exam.

See all certifications