générer un bouton aléatoire pour un site - retour accueil
git clone git://bebou.netlib.re/rw
Log | Files | Refs | README |
commit ecba16251f00657925327c6562290ba229f31734 parent 097a0fe27d4b6299204264170bdeccab3c864d2e Auteurice: Arthur Pons <arthur.pons@unistra.fr> Date: Tue, 20 May 2025 17:02:56 +0200 On déplace le check du retour du find Diffstat:
M | rw | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rw b/rw @@ -33,9 +33,9 @@ done [ -z "$d" ] && { echo "Chemin vers le dossier obligatoire" >&2; exit 1; } find "$d" -name '*.html' -type f > "$tmpd/files" +[ ! -s "$tmpd/files" ] && exit 0 nb="$(< "$tmpd/files" wc -l)" -[ "$nb" = "0" ] && exit 0 < /dev/urandom tr -dc '0-9\n' | grep -oE '[0-5]..' | @@ -48,6 +48,6 @@ size="$(echo "2500/$nb" | bc)" paste "$tmpd/files" "$tmpd/random" | tr '\t\n' '\0' | - xargs -0 printf "<a href='/%s' style='position: absolute; font-size: $size; left:%s; top: %s; text-decoration: none'>${t:-❓🤔❓🤔❓🤔❓🤔❓🤔}</a>\n" | + xargs -0 printf "<a href='/%s' style='position: absolute; font-size: $size; left:%s; top: %s; text-decoration: none'>${t:-'❓🤔❓🤔❓🤔❓🤔❓🤔'}</a>\n" | shuf