From 96fdd7d8843c2b76332f255728708bd83a8418d2 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 28 Sep 2012 22:58:22 -0400 Subject: Add a function to validate shell variable names. --- 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 +} -- cgit v0.9.1