Fonction echol pour afficher du texte d'une couleur ; changement de la fonction status

This commit is contained in:
Hippolyte Chauvin 2023-05-07 22:08:11 +02:00
parent 812b4409b4
commit c80b84c506

View file

@ -6,6 +6,12 @@ cd "${HOME}/.vnc" || exit 5
# Variables # Variables
file_base="./$(hostname):1." file_base="./$(hostname):1."
echol() {
col="$1"
shift
printf '\033['"${col}"'m%s\033[0m\n' "$*"
}
error() { error() {
>&2 printf '\033[1;31m%s\033[0m %s\n' "ERROR:" "$1" >&2 printf '\033[1;31m%s\033[0m %s\n' "ERROR:" "$1"
shift shift
@ -44,9 +50,10 @@ start() {
status() { status() {
log_f="${file_base}log" log_f="${file_base}log"
if is_running; then if is_running; then
tail -f "$log_f" echol '1;32' "The VNC server is running."
tail "$log_f"
else else
echo "The VNC server is not running." echol '1;31' "The VNC server is not running."
fi fi
} }