Check if process is running in bash script
#!/bin/bash if [ -z "$(pgrep mysql)" ] then echo "Mysql is not running" else echo "Mysql is running" fi
#!/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/
diff <(cd dir1 && find | sort) <(cd dir2 && find | sort)
printf '\033[?7l'Enables
printf '\033[?7h'
#!/usr/bin/env python # -*- coding: utf-8 -*- import os for root, dirs, files in os.walk(rootpath): for filename in files: path = os.path.join(root, filename) print path
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import fnmatch pattern = "*.conf" rootpath = "/etc" for root, dirs, files in os.walk(rootpath): for filename in fnmatch.filter(files, pattern): path = os.path.join(root, filename) print pathPython 2.7 documentation on os
cat folder/* > outfile
import fileinput
with open(outfilename, 'w') as fout:
for line in fileinput.input(filenames):
fout.write(line)