diff options
author | dteske <dteske@FreeBSD.org> | 2013-05-07 03:57:45 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2013-05-07 03:57:45 +0000 |
commit | 26fb28c83ea1b7f06454ec6a8490b88857603947 (patch) | |
tree | 823806b214bed2ee44fcc2578638804efe1bb873 /usr.sbin/bsdconfig/share/common.subr | |
parent | 1b644ce9be21912bf7c02bb30611e43c80aefac0 (diff) | |
download | FreeBSD-src-26fb28c83ea1b7f06454ec6a8490b88857603947.zip FreeBSD-src-26fb28c83ea1b7f06454ec6a8490b88857603947.tar.gz |
Add f_isset() utility subroutine for checking if a variable is set but in
a more readable fashion.
Diffstat (limited to 'usr.sbin/bsdconfig/share/common.subr')
-rw-r--r-- | usr.sbin/bsdconfig/share/common.subr | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr index 3989fad..d92592c 100644 --- a/usr.sbin/bsdconfig/share/common.subr +++ b/usr.sbin/bsdconfig/share/common.subr @@ -195,6 +195,16 @@ f_getvar() return $__retval } +# f_isset $var +# +# Check if variable $var is set. Returns success if variable is set, otherwise +# returns failure. +# +f_isset() +{ + eval [ \"\${${1%%[$IFS]*}+set}\" ] +} + # f_die [ $status [ $fmt [ $opts ... ]]] # # Abruptly terminate due to an error optionally displaying a message in a |