Challenge - 5 Problems
Shell Environment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why do shell environment setup files like .bashrc or .zshrc customize the shell?
Which of the following best explains why environment setup files customize the shell?
Attempts:
2 left
💡 Hint
Think about what happens when you open a terminal and want your tools ready.
✗ Incorrect
Environment setup files like .bashrc run commands and set variables to prepare your shell with your preferred settings, like paths and aliases.
💻 Command Output
intermediate2:00remaining
What is the output of sourcing a .bashrc file that sets a variable?
Given a .bashrc file with the line
export GREETING='Hello', what will be the output of running echo $GREETING after sourcing the file?Linux CLI
source ~/.bashrc echo $GREETING
Attempts:
2 left
💡 Hint
Sourcing runs the commands in the file in the current shell.
✗ Incorrect
Sourcing .bashrc runs the export command, setting GREETING in the current shell, so echo prints 'Hello'.
📝 Syntax
advanced2:00remaining
Identify the syntax error in this environment setup snippet
Which option contains the correct syntax to add a directory to the PATH variable in a shell setup file?
Linux CLI
PATH=$PATH:/new/path
Attempts:
2 left
💡 Hint
PATH entries are separated by colons without extra characters.
✗ Incorrect
The correct syntax appends the new path with a colon separator. Other options have invalid separators or operators.
🔧 Debug
advanced2:00remaining
Why does this environment variable not persist after opening a new shell?
A user adds
MY_VAR='test' to a shell script and runs it. Why is MY_VAR not available in a new terminal session?Attempts:
2 left
💡 Hint
Think about how environment variables propagate between shells.
✗ Incorrect
Variables set in a script run as a child process do not affect the parent shell or new shells unless exported and saved in startup files.
🚀 Application
expert3:00remaining
How to customize the shell prompt to show current directory and username?
Which command correctly sets the shell prompt to display the username and current directory in the format
user@dir$?Attempts:
2 left
💡 Hint
Use special backslash codes for username and working directory in PS1.
✗ Incorrect
In PS1, \u is username and \w is full current directory path. Option A matches the required format.