You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
450 B
30 lines
450 B
getvar() {
|
|
eval "echo \"\${$1}\""
|
|
}
|
|
|
|
var2file() {
|
|
local var
|
|
eval "var=\"\${$1}\""
|
|
if [ -n "$var" ]; then echo "$var" > "$2"; fi
|
|
}
|
|
|
|
isset() {
|
|
local var
|
|
eval "var=\"\${$1}\""
|
|
[ -n "$var" ]
|
|
}
|
|
|
|
trapret() {(
|
|
local retvals="$1"; shift
|
|
local cmd="$1"; shift
|
|
for retval in $(echo $retvals); do
|
|
local trap_$retval=1
|
|
done
|
|
"$cmd" "$@" || {
|
|
local retval="$?"
|
|
eval "trapped=\${trap_$retval}"
|
|
[ -n "$trapped" ] || {
|
|
return $retval
|
|
}
|
|
}
|
|
)}
|
|
|