From 97c0e839fea71df6caefca601fdc34469fd7b2b5 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 22 Apr 2019 23:33:47 -0500 Subject: urlprintf got an extra sanity check --- uriprintf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'uriprintf') diff --git a/uriprintf b/uriprintf index f79d067..1ca3b99 100755 --- a/uriprintf +++ b/uriprintf @@ -1,5 +1,9 @@ #!/bin/sh cutargs="$(printf "%s\n" "$1" | sed 's/%[^sukdPpqfU]//g' | tr '%' '\n' | tail -n+2 | sed 's/^\(.\).*/-\1/g' | tr '\n' ' ')" count="$(echo $cutargs | tr '-' '\n' | grep -c .)" -printfargs="$(printf "%s\n" "$1" | sed 's/%[sukdPpqfU]/%s/g')" -uricut "$cutargs" | tr '\n' '\0' | xargs -n $count -0 printf "$printfargs" +if [ "$count" = 0 ];then + printf "%s\n" "$1" +else + printfargs="$(printf "%s\n" "$1" | sed 's/%[sukdPpqfU]/%s/g')" + urlcut "$cutargs" | tr '\n' '\0' | xargs -n $count -0 printf "$printfargs" +fi -- cgit v1.2.3