Read a file line by line in bash
while read line
do
echo $line
done < test.txt
oneliner version
while read line ; do echo $line ; done < test.txt
while read line
do
echo $line
done < test.txt
while read line ; do echo $line ; done < test.txt
#!/bin/bash
if [ -z "$(pgrep mysql)" ]
then
echo "Mysql is not running"
else
echo "Mysql is running"
fi
mysqldump -u user -p password | gzip > outputfile.sql.gz
gunzip < outputfile.sql.gz | mysql -u user -p password databasenameadapted from http://www.ducea.com/2006/10/28/compressing-mysqldump-output/