f_substr: Write to stdout when no `-v var_to_set'

Fixes ``setvar: : bad variable name''
This commit is contained in:
Devin Teske 2016-02-03 03:03:04 +00:00
parent 679f1eab00
commit 9e81c4fb73

View File

@ -146,7 +146,11 @@ f_substr()
fi
done
setvar "$__var_to_set" "$__tmp"
if [ "$__var_to_set" ]; then
setvar "$__var_to_set" "$__tmp"
else
echo "$__tmp"
fi
}
# f_sprintf $var_to_set $format [$arguments ...]