Basic Shell Scripting with Variables and Loops
📖 Scenario: You are learning how to automate simple tasks in the Linux shell using Bash or Zsh. Imagine you want to keep track of your favorite fruits and print a message for each one.
🎯 Goal: Create a shell script that stores a list of fruits, sets a greeting message, loops through the fruits, and prints a personalized message for each fruit.
📋 What You'll Learn
Create a variable called
fruits containing the exact list: apple, banana, cherryCreate a variable called
greeting with the exact text: "I love"Use a
for loop with variable fruit to iterate over fruitsPrint the message combining
greeting and fruit exactly as shown💡 Why This Matters
🌍 Real World
Shell scripts like this help automate repetitive tasks such as processing lists of files, users, or data entries.
💼 Career
Basic shell scripting is essential for system administrators, developers, and anyone working with Linux servers or automation.
Progress0 / 4 steps