Recall & Review
beginner
What is the first line in a Bash script that tells the system which interpreter to use?
The first line is called the shebang. It looks like
#!/bin/bash and tells the system to use the Bash shell to run the script.Click to reveal answer
beginner
How do you make a Bash script executable?
Use the command
chmod +x scriptname.sh to give execute permission to your script.Click to reveal answer
beginner
What command runs a Bash script named
hello.sh in the current directory?Run the script with
./hello.sh if it has execute permission.Click to reveal answer
beginner
What does this simple Bash script do?
#!/bin/bash echo "Hello, world!"
It prints the text
Hello, world! to the screen.Click to reveal answer
beginner
Why is it important to save your Bash script with a
.sh extension?The
.sh extension helps you and others recognize the file as a shell script, but it is not required for execution.Click to reveal answer
What does the shebang line
#!/bin/bash do in a Bash script?✗ Incorrect
The shebang line tells the system which program to use to run the script.
Which command makes a Bash script executable?
✗ Incorrect
The
chmod +x command adds execute permission to the script.How do you run a Bash script named
myscript.sh in the current folder?✗ Incorrect
Use
./myscript.sh to run the script if it has execute permission.What does the command
echo "Hello" do in a Bash script?✗ Incorrect
The
echo command prints text to the screen.Is the
.sh extension required to run a Bash script?✗ Incorrect
The extension is not required but is a helpful convention.
Describe the steps to create and run your first Bash script.
Think about writing, saving, permission, and running.
You got /6 concepts.
Explain the purpose of the shebang line in a Bash script and what happens if it is missing.
Focus on interpreter selection and script execution.
You got /4 concepts.