DevOps ka real kaam yahan se start hota hai.
Jo kaam tum manually 10 baar kar rahe ho, DevOps usko script likh ke 1 baar karta hai.
Shell scripting means:
DevOps engineer ka sabse pehla automation tool = Bash
nano hello.sh
#!/bin/bash
echo "Hello DevOps World"
chmod +x hello.sh
./hello.sh
#!/bin/bash batata hai kaunsa shell use hoga.
#!/bin/bash
NAME="Suraj"
echo "Hello $NAME"
Variables help DevOps scripts become flexible.
#!/bin/bash
echo "Enter your name:"
read USER
echo "Welcome $USER"
Scripts can interact with humans or systems.
#!/bin/bash
if [ -f "/etc/passwd" ]; then
echo "File exists"
else
echo "File missing"
fi
Production scripts are full of conditions.
#!/bin/bash
for i in 1 2 3 4 5
do
echo "Deployment step $i"
done
Imagine deploying 50 servers without loops — impossible.
Check disk usage and alert.
#!/bin/bash
USAGE=$(df / | tail -1 | awk '{print $5}' | sed 's/%//')
if [ $USAGE -gt 80 ]; then
echo "Warning: Disk usage above 80%"
else
echo "Disk usage normal"
fi
This is real-world DevOps thinking.
Without shell scripting, DevOps engineer incomplete hai.
Now we need team collaboration. That means Git & Version Control.
Next Part → Git & Version Control