Recall & Review
beginner
What is the first line in a bash script file and why is it important?
The first line is called the shebang (e.g.,
#!/bin/bash). It tells the system which program to use to run the script.Click to reveal answer
beginner
How do you make a bash script file executable?
Use the command
chmod +x filename.sh to give execute permission to the script file.Click to reveal answer
beginner
What command runs a bash script named
myscript.sh in the current directory?Run the script with
./myscript.sh if it has execute permission.Click to reveal answer
beginner
Why should you use simple text editors like nano or vim to create a .sh file?
Because they save files as plain text without extra formatting, which is required for scripts to run correctly.
Click to reveal answer
beginner
What does the
echo command do in a bash script?It prints text or variables to the screen, helping you show messages or output.
Click to reveal answer
What does the shebang line
#!/bin/bash do in a script?✗ Incorrect
The shebang tells the system which program to use to run the script.
Which command makes a script file executable?
✗ Incorrect
chmod +x adds execute permission to the script file.
How do you run a script named
test.sh in the current folder?✗ Incorrect
Use ./test.sh to run the script if it has execute permission.
Which editor is best for creating a bash script file?
✗ Incorrect
nano is a simple text editor that saves plain text files needed for scripts.
What does the command
echo "Hello" do in a script?✗ Incorrect
echo prints the text Hello to the screen.
Explain the steps to create and run a simple bash script file.
Think about writing, saving, permission, and running.
You got /6 concepts.
Why is it important to use the shebang line in a bash script?
It tells the system how to run the script.
You got /3 concepts.