From 4606fd8469199d5497b4b2fa4ea74d237ec9688b Mon Sep 17 00:00:00 2001 From: ensa Date: Tue, 30 Jun 2020 01:26:35 -0700 Subject: fixed bin/lh bin/lh: url sent to findredir via a pipe instead --- bin/lh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/lh b/bin/lh index 4332487..40d747d 100755 --- a/bin/lh +++ b/bin/lh @@ -25,7 +25,7 @@ lstrip() { # prints all redirect locations findredir() { #note: for loop turns all whitespace into newlines - for line in $(curl -sIL "$1") + for line in $(curl -sIL "$(cat)") do # catch is used to find the line after location: if [ -n "$catch" ] @@ -44,7 +44,7 @@ findredir() { } # handle redirects. tr removes control characters, so the case statement below works as expected. -URL=$(findredir|tail -1|tr -d '[:cntrl:]') +URL=$(echo "$1"|findredir|tail -1|tr -d '[:cntrl:]') # if there were no redirects, just set URL to the first argument [ -z "$URL" ] && URL="$1" -- cgit 1.4.1-2-gfad0