ajouter quietc_echo

This commit is contained in:
Jephté Clain 2024-02-27 12:04:07 +04:00
parent dc5c078213
commit b8f3614d0a
1 changed files with 17 additions and 2 deletions

View File

@ -167,18 +167,33 @@ function: quietc_logto "\
Si quietc est utilisé, sauvegarder quand même la sortie dans le fichier \$1
Utiliser l'option -a pour ajouter au fichier au lieu de l'écraser e.g
quietc_logto -a path/to/logfile"
quietc_logto -a path/to/logfile
Tous les autres arguments sont du contenu ajoutés au fichier, e.g
quietc_logto -a path/to/logfile \"\\
================================================================================
= \$(date +%F-%T)\""
function quietc_logto() {
local append
if [ "$1" == -a ]; then
shift
append=1
fi
NULIB_QUIETLOG="$1"
NULIB_QUIETLOG="$1"; shift
[ -n "$NULIB_QUIETLOG" ] || return
if [ -z "$append" ]; then
>"$NULIB_QUIETLOG"
fi
if [ $# -gt 0 ]; then
echo "$*" >>"$NULIB_QUIETLOG"
fi
}
function: quietc_echo "Ajouter \$* dans le fichier mentionné par quietc_logto() le cas échéant"
function quietc_echo() {
if [ -n "$NULIB_QUIETLOG" ]; then
echo "$*" >>"$NULIB_QUIETLOG"
fi
}
# variables utilisées pour l'affichage indenté des messages et des titres