|
/dev/null is to keep grep quiet... otherwise it would outputthe line
thatmatched. If you want to see it when a match is found, then
you could take that out. The break is there so when it finds
a match it breaks out of the loop, since there's no reason to
keep looping once a match is found.
If you want to pipe the output of scs2ascii through this
script, you would have to do it like so:
#! /bin/bash
file=`cat /dev/stdin`
users="PHILLIP SAM RICHARD"
for user in $users; do
echo "$file" | grep $user >/dev/null && echo "$file" >
/home/misadmin/"$user"_`date
+%Y-%m-%d-%H:%m` && break
done
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.