add support for a common shell include file, which is evaluated for every make shell...
[openwrt-10.03/.git] / include / shell.sh
diff --git a/include/shell.sh b/include/shell.sh
new file mode 100644 (file)
index 0000000..6ee0cf6
--- /dev/null
@@ -0,0 +1,15 @@
+getvar() {
+       eval "echo \"\${$1}\""
+}
+
+var2file() {
+       local var
+       eval "var=\"\${$1}\""
+       if [ -n "$var" ]; then echo "$var" > "$2"; fi
+}
+
+isset() {
+       local var
+       eval "var=\"\${$1}\""
+       [ -n "$var" ]
+}