Machine-translated by Google. Questions are authored in English.
Top

Discussion

In a UNIX shell, the command VAR=10; export VAR does which of the following ?

  • A.Creates a local variable visible only to the current shell
  • B.Creates a read-only variable
  • C.Makes the variable available to child processes
  • D.Deletes the variable after command execution

Answer: C

The command makes the variable available to child processes.

VAR=10 creates a shell variable that exists only in the current shell. export VAR then marks it for the environment, so every program or subshell started from this shell afterwards receives a copy of VAR with the value 10. A script run from the shell can read it, for example with echo $VAR.

Option A describes VAR=10 on its own, before the export. A read-only variable is made with the readonly command, and a variable is deleted with unset; export does neither.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.