Challenge - 5 Problems
Export Command Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of the export command?
You run the following commands in a Linux shell:
MYVAR=hello export MYVAR exportWhat will be part of the output when you run
export?Linux CLI
MYVAR=hello export MYVAR export
Attempts:
2 left
💡 Hint
The export command without arguments lists all exported variables.
✗ Incorrect
The export command without arguments prints all environment variables that are exported. Since MYVAR was exported, it will appear in the list with its value.
💻 Command Output
intermediate2:00remaining
What happens when you export a variable with spaces?
Consider the commands:
export MYVAR=hello world export MYVARWhat will happen when you run these commands in a Linux shell?
Linux CLI
export MYVAR=hello world export MYVAR
Attempts:
2 left
💡 Hint
Spaces in variable values need quotes.
✗ Incorrect
Without quotes, the shell treats 'world' as a separate command or argument, causing a syntax error.
🔧 Debug
advanced2:00remaining
Why does this export command not set the variable in the parent shell?
You run this command in your shell:
export MYVAR=helloThen in a new terminal, you run:
echo $MYVARBut it prints nothing. Why?
Linux CLI
export MYVAR=hello
# In a new terminal:
echo $MYVARAttempts:
2 left
💡 Hint
Think about how environment variables are inherited.
✗ Incorrect
Environment variables set with export exist only in the current shell session and its children. New terminals start new shells without those variables.
🧠 Conceptual
advanced2:00remaining
What is the effect of 'export -n VAR' in Linux shell?
You have a variable VAR exported. What does the command
export -n VAR do?Linux CLI
export VAR=hello export -n VAR
Attempts:
2 left
💡 Hint
The -n option removes export status.
✗ Incorrect
The export -n command removes the export attribute from the variable, so it remains in the shell but is not passed to child processes.
🚀 Application
expert2:00remaining
How to export multiple variables in one command correctly?
You want to export two variables VAR1 and VAR2 with values 'foo' and 'bar' in one command. Which command does this correctly?
Attempts:
2 left
💡 Hint
Multiple variables can be exported in one export command separated by spaces.
✗ Incorrect
The export command accepts multiple variable assignments separated by spaces. Commas or && are not valid separators here.