Task1- BashBlaze-7-Days-of-Bash-Scripting-Challenge
๐ Excited to share my Day 1 tasks for the BashBlaze-7-Days-of-Bash-Scripting-Challenge! ๐
Task 1: Comments
In bash scripts, comments are used to add explanatory notes or disable certain lines of code.
Task 2: Echo
The echo
command is used to display messages on the terminal.
Task 3: Variables
Variables in bash are used to store data and can be referenced by their name.
Task 4: Using Variables
Now that you have declared variables, let's use them to perform a simple task. Create a bash script that takes two variables (numbers) as input and prints their sum using those variables.
Task 5: Using Built-in Variables
Bash provides several built-in variables that hold useful information. Your task is to create a bash script that utilizes at least three different built-in variables to display relevant information.
Task 6: Wildcards
Wildcards are special characters used to perform pattern matching when working with files. Your task is to create a bash script that utilizes wildcards to list all the files with a specific extension in a directory.
#!/bin/sh
#Task1: Comments
#This script showcases the use of Comments in the Script. Comments are used to add explanatory notes or disable certain lines of code.
#Task2: Echo
#The echo command is used to display messages on the terminal
echo "Let's learn DevOps together"
#Task3: Variabes
#Variables in bash are used to store data and can be referenced by their name.
name="Kunwar Shashwat"
age=32
country="India"
#Task4: Using Variables
#this sections takes two numbers as input and print their sum.
read -p "Enter the first number: " num1
read -p "Enter the second number: " num2
sum=$((num1 + num2))
echo "Sum of $num1 and $num2 is: $sum"
#Task5: Using Built-in Variables
#Bash provides several built-in variables that hold useful information.
echo "Script name: $0"
echo "User running the script: $USER"
echo "Current working directory: $PWD"
#Task6: Wildcards
#Wildcards are special characters used to perform pattern matching when working with files.
extension=".txt"
echo "Files with '$extension' extension:"
ls *$extension
I've completed tasks 1 to 6, showcasing my knowledge in Bash scripting. The script includes comments to explain each section of the code, making it easy to understand.
To submit my entry, I created a GitHub repository and committed the Day1.sh
script to it. Check out my work here: Challenges/Day1.sh
Feeling empowered to take on more challenges and enhance my DevOps skills! Let's continue this amazing journey together with the #90DaysOfDevOpsChallenge. Happy scripting! ๐ #DevOps #BashScripting #GitHub #LearningOpportunities #BashBlaze-7-Days-of-Bash-Scripting-Challenge