0
0
Linux CLIscripting~20 mins

Why environment setup customizes the shell in Linux CLI - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Shell Environment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2: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?
AThey set variables and commands that prepare the shell for user tasks and preferences.
BThey permanently change the operating system kernel settings.
CThey install new software packages automatically when the shell starts.
DThey delete all previous shell history to start fresh every time.
Attempts:
2 left
💡 Hint
Think about what happens when you open a terminal and want your tools ready.
💻 Command Output
intermediate
2: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
Aexport GREETING='Hello'
B$GREETING
CHello
DNo output, variable not set
Attempts:
2 left
💡 Hint
Sourcing runs the commands in the file in the current shell.
📝 Syntax
advanced
2: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
APATH=$PATH::/new/path
BPATH=$PATH;:/new/path
CPATH=$PATH+/new/path
DPATH=$PATH:/new/path
Attempts:
2 left
💡 Hint
PATH entries are separated by colons without extra characters.
🔧 Debug
advanced
2: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?
ABecause the variable name is invalid and ignored by the shell.
BBecause the variable was set in a child shell and not exported or saved in a startup file.
CBecause the shell automatically clears all variables on startup.
DBecause the user did not restart the computer.
Attempts:
2 left
💡 Hint
Think about how environment variables propagate between shells.
🚀 Application
expert
3: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$?
APS1='\u@\w$ '
BPS1='$USER@$PWD$ '
CPS1='user@dir$ '
DPS1='\h:\W$ '
Attempts:
2 left
💡 Hint
Use special backslash codes for username and working directory in PS1.