🚀 Day 1 of 100 Shell Scripting Problems in 20 Days — Hello Shell!

Kaushal KishoreKaushal Kishore
4 min read

🚀 100 Shell Scripting Problems in 20 Days — Day 1: Hello Shell! 🔥

Hey everyone! 👋

I'm Kaushal, and I’ve started a new learning sprint:

💡 Solve 100 Shell Scripting Problems in 20 Days (5 problems per day)

Why? Because Shell scripting is a superpower for automation, system management, DevOps, and more. And what better way to learn than by doing it every single day?

📁 I’m also uploading all of my scripts to GitHub: 👉 GitHub - kaushalacts


📅 Day 1 — Back to the Basics 🧱

Today’s focus was on the absolute fundamentals. Here are the 5 problems I tackled:


✅ Problem 1: Print “Hello, World!” 🌍

Objective: The most iconic first step — get something to print on the screen!

✅ Problem 2: Take User Input 💬

Objective: Prompt the user to enter their name and greet them.

#!/bin/bash

# ┌──────────────────────────────────────────────┐
# │ 📥 Script 02: User Input and Variables       │
# └──────────────────────────────────────────────┘

clear
echo "=========================================="
echo "   🐚 Shell Scripting Practice Series 💻"
echo "------------------------------------------"
echo "   🚀 Script 02: User Input"
echo "   📅 Day 1 | Task 2"
echo "=========================================="
echo

# Ask for user's name
read -p "👉 Please enter your name: " username

# Greet the user
echo
echo "👋 Hello, $username! Welcome to Day 1 of your Shell scripting journey 🚀"
echo "💡 Tip: You can use \`read\` to collect user input into variables."
echo
echo "🔁 Run again using: bash P2_user_input.sh"
echo "=========================================="

Run the command : ./P2_user_input.sh

✅ Problem 3: Add Two Numbers ➕➕

Objective: Read two numbers and output their sum.

 #!/bin/bash

echo "==============================================="
echo "*******ADD TWO NUMBERS**********************"

echo "Enter the first number:" 
read num1
echo "Enter the second number:" 
read num2 

sum=$((num1 + num2))



echo "Sum of the two numbers is: $sum"


echo "Happy Learning ! "

✅ Problem 4: Check if a Number is Odd or Even 🔢

Objective: Read a number and determine whether it’s odd or even (with a twist for zero).

#!/bin/bash

echo "================================================================="
echo "------***********Welcome to Day1 _fourth problem*******---------"
echo "================================================================"

echo "Enter the number to check if it is odd or even" 
read num

# Use modulus operator to check
if [ "$num" -eq 0 ]; then
    echo "Oh no! It's zero."
elif [ $((num % 2)) -eq 0 ]; then
    echo "This number is even."
else
    echo "This number is odd."
fi

✅ Problem 5: Factorial of a Number 🧠

Objective: Calculate the factorial of a given number using a for loop.

#!/bin/bash

echo "========================================================"
echo "          Welcome to factorial finder script            "
echo "========================================================"

echo "Enter a number:"
read num

# Check for positive and negative number first 
if [ "$num" -lt 0 ]; then
    echo "Factorial for numbers less than zero is not defined."
elif [ "$num" -eq 0 ]; then
    echo "The factorial of 0 is 1"
else
    fact=1
    for (( i=1; i<=num; i++ ))
    do
        fact=$((fact * i))
    done 
    echo "The factorial for $num is $fact"
fi

echo "          Happy Learning !       "

📁 Folder Structure on GitHub

Here’s how I’m organizing my repo:

perlCopyEditshell-practice-/
│
├── 01_basics/
│   ├── 01_hello_world.sh
│   ├── 02_user_input.sh
│   ├── 03_add_numbers.sh
│   ├── 04_odd_even.sh
│   ├── 05_factorial.sh
│
└── README.md

All code is version-controlled and available for reference ✅

🔥 Tips & Learnings from Day 1:

  • ✅ Always add execution permission: chmod +x script.sh

  • ✅ Remember spacing in conditionals: [ "$num" -eq 0 ] (spacing is vital!)

  • ❌ Avoid fact= $(...) – that’s invalid syntax in shell arithmetic

  • ✅ Use read to accept dynamic input from users

  • ✅ Modularize your scripts and keep them organized by topic

🌟 What's Coming in Day 2?

Coming up next:

  • Conditional branching using case

  • Working with loops (while, until)

  • Basic file handling

  • User-defined functions

  • Intro to system commands

🔗 Follow My Journey

👨‍💻 GitHub: kaushalacts
📝 Hashnod
e: Follow this series for daily updates
🔗 (Optional) LinkedIn: [https://www.linkedin.com/in/kaushalacts/]


💡 Everything is an experience — don’t worry if you’re not perfect or selected. Every mistake is a step forward. Just keep learning. Just keep scripting. 💻🔥

0
Subscribe to my newsletter

Read articles from Kaushal Kishore directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kaushal Kishore
Kaushal Kishore

Currently working as a Network Operations Center (NOC) Engineer at Verizon Networks under HCLTech as a Graduate Engineer Trainee (GET), I specialize in monitoring and maintaining critical network infrastructures. While I ensure seamless network uptime and resolve incidents at the provider level, I am also deeply passionate about transitioning into the DevOps space. With hands-on exposure to CI/CD pipelines, Docker, GitHub Actions, Ansible, and other modern DevOps tools, I am consistently upskilling to bridge the gap between operations and development. My journey reflects a dynamic shift from traditional NOC responsibilities to automation-driven DevOps workflows—combining reliability, efficiency, and innovation.