Challenge - 5 Problems
Script Runner Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this script execution command?
You have a script named
What will be the output if you run
hello.sh with the following content:#!/bin/bash echo "Hello, world!"
What will be the output if you run
bash hello.sh in the terminal?Bash Scripting
#!/bin/bash echo "Hello, world!"
Attempts:
2 left
💡 Hint
Running a script with
bash executes the commands inside it and prints output.✗ Incorrect
Using
bash hello.sh runs the script with bash interpreter, printing the echo output.💻 Command Output
intermediate2:00remaining
What happens when you run a script without execute permission?
You have a script
The file does NOT have execute permission. What happens if you run
myscript.sh with content:#!/bin/bash echo "Run me!"
The file does NOT have execute permission. What happens if you run
./myscript.sh?Bash Scripting
#!/bin/bash echo "Run me!"
Attempts:
2 left
💡 Hint
Trying to run a file without execute permission causes a permission error.
✗ Incorrect
Without execute permission, the shell refuses to run the script directly and shows a permission denied error.
📝 Syntax
advanced2:00remaining
Which command correctly runs a script named
script.sh located in the current directory?You want to run
script.sh from the terminal. Which command will run it correctly assuming it has execute permission?Attempts:
2 left
💡 Hint
Scripts in the current directory need a path prefix to run directly.
✗ Incorrect
To run a script in the current directory, you must prefix it with
./ to specify the path.🔧 Debug
advanced2:00remaining
Why does this script fail to run with
./runme.sh?Script
You try
What is the cause?
runme.sh content:echo "Start" echo "Done"
You try
./runme.sh but get:bash: ./runme.sh: Permission deniedWhat is the cause?
Attempts:
2 left
💡 Hint
Permission denied means the OS won't let you run the file.
✗ Incorrect
Without execute permission, the OS blocks running the script even if the content is valid.
🚀 Application
expert3:00remaining
What is the output of this script execution with environment variable?
Given the script
You run:
What is the output?
envtest.sh:#!/bin/bash echo "User is: $USER"
You run:
USER=guest ./envtest.shWhat is the output?
Bash Scripting
#!/bin/bash echo "User is: $USER"
Attempts:
2 left
💡 Hint
Setting an environment variable before a command overrides it inside the script.
✗ Incorrect
The
USER variable is set to guest only for the script execution, so it prints that value.