Skip to main content

Command Palette

Search for a command to run...

Day 8 Task: Shell Scripting Challenge

Published
โ€ข2 min readโ€ขView as Markdown
Day 8 Task: Shell Scripting Challenge
S

Hi, I'm Shubham Tiwari!

I love working with technology and specialize in managing cloud systems. At Infosys, I've developed strong skills in Linux, Shell Scripting, and tools like Jenkins, Docker, Kubernetes, AWS, and Azure. My focus is on building robust solutions and making a real difference in every project.

I've successfully deployed microservices using Docker and Kubernetes, automated CI/CD pipelines with Jenkins, and managed infrastructure with Terraform on AWS and Azure. I also use Prometheus and Grafana for monitoring, ensuring system reliability and performance.

I'm passionate about collaborating with teams, driving projects to success, and constantly learning and growing in the DevOps field.

Skills:

Operating Systems: Windows, Linux Automation Scripting: Shell Scripting Version Control: Git, GitHub Containerization: Docker, Kubernetes CI/CD Tools: Jenkins, ArgoCD Cloud Platforms: AWS, Azure Infrastructure as Code: Terraform, Azure ARM Templates Monitoring: Prometheus, Grafana Programming Language: Python

Let's collaborate: tiwari.shubham7004@gmail.com

Feel free to reach out for collaboration or exciting opportunities! ๐Ÿš€

Task 1 - 3

In bash scripts, comments are used to add explanatory notes or disable certain lines of code. Your task is to create a bash script with comments explaining what the script does.

#!/bin/bash

# This script prints a greeting message to the user

# Print a welcome message
echo "Welcome to my script!"

# Ask the user for their name
read -p "Please enter your name: " name

# Print a personalized greeting message
echo "Hello, $name! Nice to meet you!"
  1. 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.

#!/bin/bash

# This script takes two numbers as input and prints their sum

# Prompt the user to enter the first number
read -p "Enter the first number: " num1

# Prompt the user to enter the second number
read -p "Enter the second number: " num2

# Calculate the sum of the two numbers
sum=$((num1 + num2))

# Print the sum
echo "The sum of $num1 and $num2 is $sum"
  1. 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.
#!/bin/bash

# This script displays information about the current shell session

# Display the current working directory using $PWD
echo "Current working directory: $PWD"

# Display the username of the current user using $USER
echo "Current user: $USER"

# Display the shell name and version using $BASH and $BASH_VERSION
echo "Shell: $BASH, Version: $BASH_VERSION"
  1. 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/bash

# List all files with.txt extension in the current directory
echo "Files with.txt extension:"
ls *.txt

Example Output:

Files with.txt extension:
file1.txt
file2.txt
example.txt

List all files with a.jpg or .jpeg extension

#!/bin/bash

# List all files with.jpg or.jpeg extension in the current directory
echo "Files with.jpg or.jpeg extension:"
ls *.jpg *.jpeg

List all files with exactly 3 characters in the filename

#!/bin/bash

# List all files with exactly 3 characters in the filename
echo "Files with exactly 3 characters in the filename:"
ls ???

Join me on a 90-day DevOps challenge! Follow this blog post for updates as I level up my skills and take on new challenges. Let's do this!"

#HappyLearning #DevOpshashtag#Linuxhashtag#UserManagementhashtag#EC2hashtag#LearningJourneyhashtag#Techhashtag#CloudComputing #Shubham Londhe #TrainWithShubhamhashtag#Linuxhashtag#Ubuntu
hashtag#AWShashtag#90daysofdevops