Shell scripting for Devops


A shell script is a file in which you have written shell commands in sequences.
Let’s talk about file types:
If we have a Python file, then the file type is (.py).
Similarly,
Python - (.py)
Java - (.java)
C++ - (.cpp)
C - (.c)
Shell - (.sh)
username.sh for making a folder, here, ‘sh’ is the file type.
In shell commands, firstly we use Shebang (#!/bin/bash).
\It tells the computer which programme (shell) should be used to run the rest of the script.
And after that, executing permission( ls-l).
then give a permission according to your work
like if you want the file which name is vikash.sh, you have to give read, write, execute permission then
chmod764 vikash.sh
after that for executing file then use (./vikash.sh)
lets create some examples for you
in file vim vikash.sh
hero = “rancho”
here “hero” is variable
here = is operator
and “rancho” is value
So, if we want to print, we have to use a variable.
Hero = “Raja”
Villain = “Shivam”
Then,
echo “Movie hero is $Hero”
echo “Villain is $Villain”
After saving it using [esc :wq]
Give permission to this file using
chmod 764
After that,
Execute the file by using (./vikash.sh)
PREDIFIEND USER EXAPLE
echo “Current logged-in user: $USER”
If we want to take input from the user, then
read -p “What is Rancho’s full name?” fullname
echo “Full name of Rancho is $fullname”
CREATE USER USING SHELL
read -p "enter the user name:" username
read -p "enter tha pssword:" "password"
useradd -m -p "$password" "$username"
for making the user name with virus then ⬇️
it will create user
Subscribe to my newsletter
Read articles from AWSomeVikash directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

AWSomeVikash
AWSomeVikash
🚀 Hi, I'm Vikash Patel — a passionate AWS & DevOps enthusiast, sharing my complete learning journey and real-world implementations. 📘 On this blog, I’m publishing a full DevOps + AWS roadmap — from basics to advanced, covering: 🟡 AWS Services: EC2, S3, IAM, CloudWatch, Billing, and more 🐧 Linux commands & scripting ⚙️ CI/CD pipelines with GitHub Actions & Jenkins 🧱 Infrastructure as Code using Terraform 📈 Monitoring, Alerts & Troubleshooting 💡 Every post is beginner-friendly — focused on clarity, practical use-cases, and hands-on solutions. 🌐 I’m also building my presence in the AWS Community, sharing what I learn, and learning from others. 🌱 Whether you're starting your cloud journey or looking for practical DevOps solutions, this blog is for you.