Use standard form in test expressions. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 9f04c3111b9e367be27f34420752914bcf45b1f4 DIR parent 1f331f327482b61caa7bcf7b2607fa77ce2664a0 HTML Author: eidolon <me@elsewise.am> Date: Mon, 7 Aug 2023 18:57:11 -0400 Use standard form in test expressions. Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: M annna-message-common | 8 ++++---- M annna-start-checker-dbg | 2 +- M ffmpeg-effect | 2 +- M meme-circumcision | 2 +- M modules/linkbrother/linkbrother.sh | 4 ++-- M modules/markov_tech/markov | 2 +- M phlog-index | 2 +- M screenshot-uri | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -176,7 +176,7 @@ case "${text}" in fi ;; *youtube.com/*|*youtu.be/*) - if [ -z "${uri##*youtu.be/*}" -o -z "${uri##*/watch?v=*}" -o -z "${uri##*/embed/*}" ]; + if [ -z "${uri##*youtu.be/*}" ] || [ -z "${uri##*/watch?v=*}" ] || [ -z "${uri##*/embed/*}" ]; then ytid="${uri#https*://*/watch?v=}" ytid="${ytid##*embed/}" @@ -670,7 +670,7 @@ case "${text}" in linkserver="$(printf "%s\n" "${randomlink}" | cut -d '|' -f4)" linkport="$(printf "%s\n" "${randomlink}" | cut -d '|' -f5 | cut -d']' -f1)" outtext="$(printf "%s - gopher://%s" "$linktext" "$linkserver")" - if [ "$linkport" != "70" -a "$linkport" != "port" ]; + if [ "$linkport" != "70" ] && [ "$linkport" != "port" ]; then outtext="$(printf "%s:%s" "$outtext" "$linkport")" fi @@ -1052,7 +1052,7 @@ case "${text}" in fi # Cleanup if outpath file is empty. - [ -f "${outpath}" -a ! -s "${outpath}" ] && rm "${outpath}" + [ -f "${outpath}" ] && [ ! -s "${outpath}" ] && rm "${outpath}" if [ -s "${outpath}" ]; then @@ -1299,7 +1299,7 @@ do if [ $doexpand -eq 1 ]; then taglength=$(utf8expr length "${tag}") - if [ $uriexpansion -eq 0 -a $taglength -gt 3 ]; + if [ $uriexpansion -eq 0 ] && [ $taglength -gt 3 ]; then didyoumean="$(annna-meme-recommend "${tag}")" if [ -n "${didyoumean}" ]; DIR diff --git a/annna-start-checker-dbg b/annna-start-checker-dbg @@ -11,7 +11,7 @@ do socatpid="$(pgrep -U annna -x socat)" iipid="$(pgrep -U annna -x ii)" - if [ -z "$socatpid" -o -z "$iipid" ]; + if [ -z "$socatpid" ] || [ -z "$iipid" ]; then printf "checker: Starting annna.\n" sh -x annna-stop-socat DIR diff --git a/ffmpeg-effect b/ffmpeg-effect @@ -238,7 +238,7 @@ while getopts 'hn:' opt; do esac done shift $((OPTIND - 1)) -if test "$#" -lt 3 -o ! -r "$2"; then +if [ "$#" -lt 3 ] || [ ! -r "$2" ]; then usage fi DIR diff --git a/meme-circumcision b/meme-circumcision @@ -2,7 +2,7 @@ # small wrapper script to simplify cutting part of a video. # Dependencies: ffmpeg -if test "$1" = "" -o "$2" = "" -o "$3" = ""; then +if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ]; then echo "usage: $0 <infile> <outfile> <from> <duration>" >&2 exit 1 fi DIR diff --git a/modules/linkbrother/linkbrother.sh b/modules/linkbrother/linkbrother.sh @@ -5,8 +5,8 @@ set -e dir=$(dirname $0) -if ! [ -x "$dir/linkbrother" -a "$dir/linkbrother" -nt "$dir/linkbrother.c" ]; then - cc "$dir/linkbrother.c" -o "$dir/linkbrother" +if ! [ -x "$dir/linkbrother" ] && [ "$dir/linkbrother" -nt "$dir/linkbrother.c" ]; then + cc "$dir/linkbrother.c" ] || [ "$dir/linkbrother" fi "$dir/linkbrother" "$@" DIR diff --git a/modules/markov_tech/markov b/modules/markov_tech/markov @@ -10,7 +10,7 @@ FREQ=2 ## function rand(){ max="$1" - if [ -z "$max" -o "$max" -lt 1 ]; then + if [ -z "$max" ] || [ "$max" -lt 1 ]; then max=2; fi r=$(echo "$(od -An -N2 -i /dev/urandom) % $max" | bc) DIR diff --git a/phlog-index b/phlog-index @@ -22,7 +22,7 @@ find /home/*/gopher/phlog \ cd $cache -if [ -e lsr.old -a $doforce -eq 0 ]; +if [ -e lsr.old ] && [ $doforce -eq 0 ]; then diff lsr.new lsr.old > lsr.diff else DIR diff --git a/screenshot-uri b/screenshot-uri @@ -22,7 +22,7 @@ tmpfile="$(mktemp p-XXXXXXXXXXXXX.png)" timeout -k 60s 60s firefox $firefoxargs --new-instance --screenshot \ "${pastebase}/${tmpfile}" "${uri}" >/dev/null 2>&1 # timeout(1) timed out -[ $? -eq 124 -o $? -eq 137 ] && exit 1 +[ $? -eq 124 ] || [ $? -eq 137 ] && exit 1 # Firefox stores with rw---- chmod g+wr "${pastebase}/${tmpfile}"