From 02179655f48b722e6bcd9b47b5d197ae9a7ee7b8 Mon Sep 17 00:00:00 2001 From: Mid Favila Date: Wed, 30 Jun 2021 02:19:25 -0300 Subject: [PATCH] Slightly improve readability of sed commands in plumber --- plumber | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plumber b/plumber index 96a3a04..408ffbb 100755 --- a/plumber +++ b/plumber @@ -4,7 +4,7 @@ rand_inst() # Choose a random invidious instance to distribute load. # Good digital citizenship is important, you know. { case $(($(dd bs=2 count=1 if=/dev/random of=/dev/stdout | od - | \ - sed -ne 's/ */ /gp' | cut -d ' ' -f2) % 3)) in + sed -ne 's& *& &gp' | cut -d ' ' -f2) % 3)) in 0) printf "vid.puffyan.us" ;; 1) printf "ytprivate.com" ;; 2) printf "yewtu.be" ;; @@ -15,11 +15,11 @@ if [ "$(printf "%s" "${1}"|cut -b 1,2,3,4)" = "http" ] then case "${1}" in *youtu*) exec Links "$(printf "%s" "${1}"|sed -ne \ - "s/\(http.*:\/\/\).*\(\/.*\)/\1$(rand_inst)\2/p")" & ;; + "s&\(http.*://\).*\(/.*\)&\1$(rand_inst)\2&p")" & ;; *reddit*) exec Links "$(printf "%s" "${1}"|sed -ne \ - "s/\(http.*:\/\/\).*\(\/.*\/\)/\1libredd.it\2/p")" & ;; - https://4chan.org*) exec Links "$(printf "%s" "${1}"|sed -ne \ - "s/4chan/4channel/p")" ;; + "s&\(http.*://\).*\(/.*/\)&\1libredd.it\2&p")" & ;; + *4chan.org*) exec Links "$(printf "%s" "${1}"|sed -ne \ + "s&4chan&4channel&p")" & ;; *) exec Links "${1}" & ;; esac