correct escapes

This commit is contained in:
Denis Lehmann 2022-05-19 01:05:17 +02:00
parent dd97cb372f
commit eb904a2059
2 changed files with 7 additions and 5 deletions

File diff suppressed because one or more lines are too long

10
sf
View file

@ -22,21 +22,23 @@ sftw=$'\e[97m'
# Public output functions
function sferr {
echo "${sftbf}${sftr}ERROR${sftrs} $1"
echo -e "${sftbf}${sftr}ERROR${sftrs} $1"
[ -z "$2" ] && exit 1
}
function sfwarn {
echo "${sftbf}${sfty}WARNING${sftrs} $1"
echo -e "${sftbf}${sfty}WARNING${sftrs} $1"
}
# Public input functions
function sfask {
if [ -n "$2" ]; then
read -r -p "$1? [${sftbf}y${sftrs}/${sftbf}N${sftrs}] " sfin
echo -ne "$1? [${sftbf}y${sftrs}/${sftbf}N${sftrs}] "
read -r sfin
[[ "$sfin" =~ n|N|^$ ]] && sfin=false || sfin=true
else
read -r -p "$1? [${sftbf}Y${sftrs}/${sftbf}n${sftrs}] " sfin
echo -ne "$1? [${sftbf}Y${sftrs}/${sftbf}n${sftrs}] "
read -r sfin
[[ "$sfin" =~ y|Y|^$ ]] && sfin=true || sfin=false
fi
}