Answer the question
In order to leave comments, you need to log in
Error in bash script, what's wrong?
#!/bin/bash
mask="/var/log/WARNING*"
logfile="tmp/error.log"
rm $logfile
for file in $(ls -l $mask)
do
while read line
do
echo $line >> $logfile
done < $file
echo $line >> $logfile
done
grep -E -h -s "/[a-z]{2,}/\S+" $logfile
exit 1
Answer the question
In order to leave comments, you need to log in
rm: cannot remove 'tmp/error.log': No such file or directory
for file in $(ls -l $mask) do while read line do echo $line >> $logfile done < $file echo $line >> $logfile done
find -name "$mask" -type f -print0 | xargs -0 cat >> $logfile
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question