summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-09-28 22:58:22 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-09-28 22:58:22 (EDT)
commit96fdd7d8843c2b76332f255728708bd83a8418d2 (patch)
tree1e112dcff8cad461c835ff0aff4cd602dba68319 /lib
parent7494dc3e62f6623d63e1b9a086fb5266d8bcbce4 (diff)
Add a function to validate shell variable names.
Diffstat (limited to 'lib')
-rw-r--r--lib/common.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/common.sh b/lib/common.sh
index 22b017c..ee5dcb5 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -38,3 +38,13 @@ _ob_return()
return ${1}
}
+
+_ob_validate_var_name()
+{
+ case "${1}" in
+ [!a-zA-Z_]*|*[!a-zA-Z0-9_]*)
+ return 1
+ ;;
+ esac
+ return 0
+}