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

Shell Script

The document provides a step-by-step guide on creating and running shell scripts in Linux. It includes examples such as a Hello World script, a date and username display script, and a simple addition script. The quick summary outlines the essential steps: creating a file, adding the shebang, saving, giving execute permission, and running the script.

Uploaded by

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

Shell Script

The document provides a step-by-step guide on creating and running shell scripts in Linux. It includes examples such as a Hello World script, a date and username display script, and a simple addition script. The quick summary outlines the essential steps: creating a file, adding the shebang, saving, giving execute permission, and running the script.

Uploaded by

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

Introduction to Linux

Step 1: Create a Shell Script File


🔹 Create a file

touch [Link] / nano [Link] (“You may assign any suitable name instead of ‘script1’.”)
✅ Step 2: Give Execute Permission

chmod +x [Link]
✅ Step 3: Run the Script

./[Link]
🟢 Example 1: Hello World Script

#!/bin/bash
echo "Hello, Welcome to Linux!"
🟢 Example 2: Show Date and Username

#!/bin/bash
echo "Today’s date is:"
date
echo "Logged in user:"
whoami
🟢 Example 3: Simple Addition Script

#!/bin/bash
echo "Enter first number:"
read num1
echo "Enter second number:"
read num2
sum=$((num1 + num2))
echo "Sum is: $sum"
📌 Quick Summary
1. Create → nano [Link]

2. Add #!/bin/bash on the first line

3. Save (Ctrl + X → Y → Enter)

4. Give permission → chmod +x [Link]

5. Run → ./[Link]

Design & Tech club/Term2/2025-26/Introduction to Linux OS

You might also like