Question: Writing a basic shell script. Write a script that outputs all lines in a file containing a specific keyword. Your script will be called fkey
Writing a basic shell script. Write a script that outputs all lines in a file containing a specific keyword.
Your script will be called fkey and the first argument to the script should be the keyword and the second the file
i.e. the general form of the command should be $ fkey keyword filename
For example, if the users types: $ fkey apple foo.txt your script should print every line that contain the string apple from the file foo.txt.
I like apples. I like blueberries. I like pineapples and strawberries. Apples are tasty. Bananas are sweet
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
