diff --git a/rtenets b/rtenets index c74ba02..2d79996 100755 --- a/rtenets +++ b/rtenets @@ -77,10 +77,23 @@ alt_var() { if is_set "${variable}"; then printf "%s" "$(eval "printf \"%s\" \"\${${variable}}\"")" else - printf "%s" "$value_if_unset" + printf "%s" "${value_if_unset}" fi } +# Enter value if unset +cond_enter() { + local input="$1" + local var_name="$2" + local value="$(alt_var "" "${var_name}")" + + if [[ "${value}" == "" ]]; then + value="$(enter "${input}")" + fi + + printf "%s" "${value}" +} + # Check that command exists has_command() { command -v "$1" >/dev/null 2>&1