Challenge - 5 Problems
Shell Script Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:00remaining
What is the output of this script?
Consider this bash script saved as
hello.sh and executed with bash hello.sh:#!/bin/bash echo "Hello, World!"What will be printed on the terminal?
Bash Scripting
#!/bin/bash echo "Hello, World!"
Attempts:
2 left
💡 Hint
Look at the echo command and what it prints exactly.
✗ Incorrect
The script uses echo to print the exact string "Hello, World!" including capitalization and punctuation.
📝 Syntax
intermediate1:30remaining
Which script has a syntax error?
Identify which of these bash scripts will cause a syntax error when run.
Attempts:
2 left
💡 Hint
Check if all if statements have proper closing keywords.
✗ Incorrect
Option B is missing a semicolon or newline before 'fi', causing a syntax error.
🚀 Application
advanced2:00remaining
What does this script do?
Analyze this bash script and choose the correct description of its behavior:
#!/bin/bash count=0 while [ $count -lt 3 ]; do echo "Count is $count" ((count++)) done echo "Finished counting"
Bash Scripting
#!/bin/bash count=0 while [ $count -lt 3 ]; do echo "Count is $count" ((count++)) done echo "Finished counting"
Attempts:
2 left
💡 Hint
Look at the loop condition and how count changes.
✗ Incorrect
The loop runs while count is less than 3, printing count values 0,1,2 then exits.
🔧 Debug
advanced1:30remaining
Why does this script fail to run?
This script is saved as
myscript.sh and run with ./myscript.sh. It shows Permission denied. Why?#!/bin/bash echo "Running script"
Attempts:
2 left
💡 Hint
Check file permissions with ls -l.
✗ Incorrect
Without execute permission, the shell cannot run the script directly.
🧠 Conceptual
expert2:30remaining
What is the correct way to create a script file that runs on any bash shell?
You want to create a script file named
runme.sh that works on any system with bash installed. Which option correctly creates and prepares this script?Attempts:
2 left
💡 Hint
The script needs execute permission and the correct shebang for bash.
✗ Incorrect
Option A uses the correct shebang and sets execute permission properly without over-permission.