SVN: rc-scripts/trunk/rc.d/init.d/functions

glen glen at pld-linux.org
Fri Nov 9 02:35:40 CET 2007


Author: glen
Date: Fri Nov  9 02:35:40 2007
New Revision: 9030

Modified:
   rc-scripts/trunk/rc.d/init.d/functions
Log:
- add is_empty_file() function

Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions	(original)
+++ rc-scripts/trunk/rc.d/init.d/functions	Fri Nov  9 02:35:40 2007
@@ -104,6 +104,13 @@
 	esac
 }
 
+# checks if file is empty
+# empty lines and lines beginning with hash are ignored
+is_empty_file() {
+	[ -s "$1" ] || return 0
+	egrep -vq '^(#| *$)' "$1" && return 1 || return 0
+}
+
 # returns OK if $1 contains $2
 strstr() {
 	local a=$2


More information about the pld-cvs-commit mailing list