0% found this document useful (0 votes)
3 views1 page

Bash Scripting: Basics to Advanced Guide

Uploaded by

bhanu katuwal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Bash Scripting: Basics to Advanced Guide

Uploaded by

bhanu katuwal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Bash Scripting Guide: From Basic to Advanced

===========================================

Step 1: Setup
-------------
Open Terminal and create a folder for practice:
mkdir bash_practice && cd bash_practice

Step 2: Your First Script


--------------------------
Create a file:
nano [Link]
Add:
#!/bin/bash
echo "Hello, World!"
Make executable:
chmod +x [Link]
Run:
./[Link]
Explanation:
- #!/bin/bash · Shebang, tells system to use Bash.
- echo · Prints text.
- chmod +x · Makes script executable.

Step 3: Variables
-----------------
#!/bin/bash
name="Bhanu"
echo "Hello $name"
Explanation:
- Variables store data.
- $name · Access variable.

Step 4: User Input


------------------
#!/bin/bash
read -p "Enter your name: " username
echo "Welcome $username"
Explanation:
- read · Takes input.
- -p · Prompt message.

Step 5: Conditions
------------------
#!/bin/bash
if [ $1 -gt 10 ]; then
echo "Number is greater than 10"
else
echo "Number is less or equal to 10"
fi
Run:
./[Link] 15

You might also like