Kod: Zaznacz cały
if grep -q co plik1.txt
echo "OK"
else
echo "FAIL!"
fi
Kod: Zaznacz cały
root=/home/sector/Desktop/berberis/code/
temp=/home/sector/ls.txt
ls -l ${root} | awk '{print $8}' >> ${temp}
lista=`cat ${temp}`
for loop in ${lista}
do
if grep -q TSQLQuery ${root}${loop}
then
echo "TSQLQuery OK!"
# echo ${loop} >> /home/sector/Desktop/pliki.txt
if grep -q SQLQueryEx ${root}${loop}
then
echo "SQLQueryEx OK!"
else
sed 's/SqlExpr,/SqlExpr, SQLQueryEx,/' ${root}${loop} >> ${root}${loop}.bak
mv ${root}${loop}.bak ${root}${loop}
echo "SQLQueryEx FAIL!"
fi
sed 's/TSQLQuery/TSQLQueryEx/' ${root}${loop} >> ${root}${loop}.bak
mv ${root}${loop}.bak ${root}${loop}
else echo "TSQLQuery FAIL!"
fi
done
Kod: Zaznacz cały
sector@debian:~/Desktop$ ./sed2.sh
TSQLQuery FAIL!
TSQLQuery OK!
SQLQueryEx OK!