"S.Toms" wrote:
On 25 Jun 2000, [ISO-8859-1] François Pinard wrote:
fp> [S.Toms] fp> fp> > How can I test to see if a particular file contains a particular string fp> > anywhere within it, for example, I want to see if the filename contains fp> > .lock as the suffix. fp> fp> Hello. I think the following might work (from memory, untested): fp> fp> fp> if grep -s 'STRING' FILE >/dev/null; then fp> ACTIONS_IF_FOUND fp> else fp> ACTIONS_IF_NOT_FOUND fp> fi fp>
Actually, I'm looking for a way to check the filename, not the file contents, for example, I have the following being passed into the script /home/skull/mail/Mailing Lists/SuSE List
and I want to check to see if there is a "SuSE List.lock" within that above string, I've tried the following which doesn't seem to work
if [ "$FILE" != "*.lock" ]; then
-- if [ -n "`echo $FILE | grep .lock`" ]; then echo "Suspect detected!"; fi -- N -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/