Add f_isset() utility subroutine for checking if a variable is set but in

a more readable fashion.
This commit is contained in:
Devin Teske 2013-05-07 03:57:45 +00:00
parent f5d38abdaf
commit 1d17434b64
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250317
2 changed files with 11 additions and 1 deletions

View File

@ -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

View File

@ -388,7 +388,7 @@ while :; do
var="${mtag# }"
# Toggle the state-variable and loop back to menu
if eval [ \"\${_${var}_delete+set}\" ]; then
if f_isset _${var}_delete; then
unset _${var}_delete
else
setvar _${var}_delete 1