Herb Martin
2005-07-06 03:44:55 UTC
The following is a VERY naive way to accomplish "if any
files in a pattern exist" do some stuff with them.
Please suggest the best place to ask such questions, good
web sources for learning Linux/bash/etc scripting, and
how to do this 'right' (or at least better):
#!/usr/bin/sh
for A in /etc/mail/move/*; do
if [ -f ${A} ] ; then
echo Do something with $A
echo And: mv /etc/mail/move/* /etc/mail/oldspam/
fi
done
###############end##################
When I tried the (more) naive method of merly testing on
[ -f /etc/mail/move/* ] there were errors (only) when the files
existed.
FYI: This was run on Cygwin if it matters.
files in a pattern exist" do some stuff with them.
Please suggest the best place to ask such questions, good
web sources for learning Linux/bash/etc scripting, and
how to do this 'right' (or at least better):
#!/usr/bin/sh
for A in /etc/mail/move/*; do
if [ -f ${A} ] ; then
echo Do something with $A
echo And: mv /etc/mail/move/* /etc/mail/oldspam/
fi
done
###############end##################
When I tried the (more) naive method of merly testing on
[ -f /etc/mail/move/* ] there were errors (only) when the files
existed.
FYI: This was run on Cygwin if it matters.
--
Herb Martin
Herb Martin