Moving relevant files
You have recently joined a new startup as one of the few technical employees. Your manager has asked if you can assist to clean up some of the folders on the server. The company has been through a variety of server monitoring software and so there are many files that should be deleted.
Luckily you know that all the files to keep contain both vpt
and SRVM_
inside the file somewhere.
Your task is to write a Bash script that will take in file names as ARGV elements and move the file to good_logs/
if it matches both conditions above. Remember from the lecture, the q
flag is for 'quiet' so it doesn't return the matched lines like grep
normally does. It just returns true if any lines match.
Remember that when you use command-line arguments like grep
in IF statements, there is no need for square brackets so don't add them! You must also remember to run your script using each file as an ARGV element. One each time; a total of four times to run your script.
Diese Übung ist Teil des Kurses
Introduction to Bash Scripting
Interaktive Übung
Setze die Theorie in einer unserer interaktiven Übungen in die Praxis um
