Why file I/O is core to scripting
📖 Scenario: You work as a helper for a small shop. The shop keeps a list of products and their prices in a text file. You want to write a script that reads this file, finds products that cost more than a certain amount, and saves those products to a new file. This helps the shop owner quickly see expensive items.
🎯 Goal: Build a bash script that reads a file with product prices, filters products above a price limit, and writes them to a new file.
📋 What You'll Learn
Create a file named
products.txt with exact product and price linesCreate a variable
price_limit with a specific valueUse a
while loop to read products.txt line by lineWrite products with price greater than
price_limit to expensive.txtPrint the contents of
expensive.txt at the end💡 Why This Matters
🌍 Real World
Scripts often read and write files to automate tasks like filtering logs, processing data, or generating reports.
💼 Career
Knowing file input/output is essential for automation roles, system administration, and any scripting job to handle real data.
Progress0 / 4 steps