Add f_isset() utility subroutine for checking if a variable is set but in
a more readable fashion.
This commit is contained in:
parent
f5d38abdaf
commit
1d17434b64
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user