about summary refs log tree commit diff stats
path: root/bin
diff options
context:
space:
mode:
authorensa <psii@riseup.net>2020-06-30 01:26:35 -0700
committerensa <psii@riseup.net>2020-06-30 01:26:35 -0700
commit4606fd8469199d5497b4b2fa4ea74d237ec9688b (patch)
tree4b7bc8056ba65ffc2096694d4fc22d6402d7fa0c /bin
parent3b85135ec49ac1fc0eaf55dde8ecf07982b4d9fe (diff)
downloadcfg-4606fd8469199d5497b4b2fa4ea74d237ec9688b.tar.gz
fixed bin/lh
bin/lh: url sent to findredir via a pipe instead
Diffstat (limited to 'bin')
-rwxr-xr-xbin/lh4
1 files 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"