Results 1 to 4 of 4
I am trying to write a script that will display the following words: kill, bomb, Joe Smith, quit and steal. I need the script to report to the screen the ...
- 04-19-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 87
Trouble with a bash script that finds offensive words
I am trying to write a script that will display the following words: kill, bomb, Joe Smith, quit and steal. I need the script to report to the screen the offenders username, the line with the bad word found, and path and file name. This is what I have so far:
I thought that this code would report to the screen everything that I need, but it does not. How do I get the script to report to the screen?Code:while read -rd '' file; do badfiles+=("$file"); done < <(find /home -type f -exec grep -qE 'kill|bomb|Joe Smith|quit|steal' {} \; -print0)
- 04-19-2011 #2Linux Newbie
- Join Date
- Dec 2009
- Posts
- 241
Have you tried:
Code:while read -rd '' file; do echo $file done < <(find /home -type f -exec grep -qE 'kill|bomb|Joe Smith|quit|steal' {} \; -print0)
- 04-19-2011 #3Just Joined!
- Join Date
- Jan 2011
- Posts
- 87
- 04-20-2011 #4Linux Newbie
- Join Date
- Dec 2009
- Posts
- 241
Kill the options of the read command.
just:
Code:while read file; do echo $file done < <(find /home -type f -exec grep -qE 'kill|bomb|Joe Smith|quit|steal' {} \; -print0)


Reply With Quote
