you could do something like
ks_val_ChkName() {
case "${1:?Missing Variable Name}" in
[!a-zA-Z_]* | *[!a-zA-Z_0-9]* | '' ) return 3;;
esac
}
ks_val_Set() {
ks_val_ChkName "${1}" || return $?
eval "${1}"'="${2}"'
}
ks_cgf_Src() {
local IFS=$'\n'
local LC_COLLATE=C
local cline_tmp
local vval_tmp
while read -d '' cline_tmp ; do
case "${cline_tmp}" ; in
\#* | '') continue;; # skip empty lines and commented lines
[a-zA-Z_]*=*) # *[![:space:]]*) # non empty lines
vval_tmp="${cline_tmp#*=}"
vval_tmp="${vval_tmp#["']}"
vval_tmp="${vval_tmp%["']}"
ks_val_Set "${cline_tmp%%=*}" "${vval_tmp}" || echo "error '${cline_tmp}'"
;;
*)echo "skipping '${cline_tmp}'"
continue;;
esac
done
}