0
0
Bash Scriptingscripting~15 mins

What a shell script is in Bash Scripting - Mini Project: Build & Apply

Choose your learning style9 modes available
What a shell script is
📖 Scenario: Imagine you want to tell your computer to do a few simple tasks automatically, like saying hello and showing the date. Instead of typing commands one by one, you can write them down in a file and run it all at once. This file is called a shell script.
🎯 Goal: You will create a simple shell script that prints a greeting and shows the current date.
📋 What You'll Learn
Create a shell script file with the correct first line (shebang).
Write commands inside the script to print a greeting message.
Write a command to display the current date.
Run the script to see the output.
💡 Why This Matters
🌍 Real World
Shell scripts help automate repetitive tasks on your computer, saving time and effort.
💼 Career
Knowing how to write and run shell scripts is useful for system administrators, developers, and anyone working with computers.
Progress0 / 4 steps
1
Create the shell script file with shebang
Create a file named greet.sh and add the first line #!/bin/bash to tell the computer this is a shell script.
Bash Scripting
Need a hint?

The first line #!/bin/bash tells the system to use the bash shell to run the script.

2
Add a greeting message
Add a line to the greet.sh script that prints Hello, friend! using the echo command.
Bash Scripting
Need a hint?

Use echo followed by the message in quotes to print text.

3
Add a command to show the current date
Add a line to the greet.sh script that runs the date command to show the current date and time.
Bash Scripting
Need a hint?

The date command shows the current date and time.

4
Run the shell script and see the output
Run the greet.sh script in the terminal using bash greet.sh and observe the output.
Bash Scripting
Need a hint?

Use the command bash greet.sh to run your script and see the greeting and date printed.