diff sources/utility_functions.sh @ 984:9840847885e8

Add export_if_blank and make lots of build paths overrideable.
author Rob Landley <rob@landley.net>
date Wed, 24 Feb 2010 10:08:38 -0600
parents fc134a13357e
children a3716680a825
line wrap: on
line diff
--- a/sources/utility_functions.sh	Sun Feb 21 17:07:55 2010 -0600
+++ b/sources/utility_functions.sh	Wed Feb 24 10:08:38 2010 -0600
@@ -2,6 +2,13 @@
 
 # This file contains generic functions, presumably reusable in other contexts.
 
+# Assign (export) a variable only if current value is blank
+
+export_if_blank()
+{
+  [ -z "$(eval "echo \"\${${1/=*/}}\"")" ] && export "$1"
+}
+
 # Create a blank directory at first argument, deleting existing contents if any
 
 blank_tempdir()