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