From 6827f6b8c2ee147f59642f3e3ebbc96f6164ecdc Mon Sep 17 00:00:00 2001 From: epochqwert Date: Wed, 11 Apr 2018 10:57:54 +0000 Subject: fixed printfurl to choke on stuff less often. --- printfurl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/printfurl b/printfurl index 3da61a6..91fd388 100755 --- a/printfurl +++ b/printfurl @@ -1,5 +1,5 @@ #!/bin/sh -cutargs="$(printf "%s\n" "$1" | tr '%' '\n' | tail -n+2 | sed 's/^\(.\).*/-\1/g')" -printfargs="$(printf "%s\n" "$1" | sed 's/%./%s/g')" -#printf "printfargs: %s\n" "$printfargs" -cuturl $cutargs | tr '\n' ' ' | xargs -L1 printf "$printfargs" +cutargs="$(printf "%s\n" "$1" | tr '%' '\n' | tail -n+2 | grep '^[sukdPpqfU]' | sed 's/^\(.\).*/-\1/g')" +count="$(echo $cutargs | tr '-' '\n' | grep -c .)" +printfargs="$(printf "%s\n" "$1" | sed 's/%[sukdPpqfU]/%s/g')" +cuturl "$cutargs" | tr '\n' '\0' | xargs -n $count -0 printf "$printfargs" -- cgit v1.2.3