summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
authorlassulus <lass@lassul.us>2017-05-02 20:10:36 +0200
committerlassulus <lass@lassul.us>2017-05-02 20:10:36 +0200
commit1a7d62733ca6d49114d5a19eeb6052d51a7c19b2 (patch)
tree542a37adb9d07184a9098c51ac31048075f34d9d /krebs/5pkgs
parent9afa7168001dd19b23e63786102d2ede5b8328be (diff)
k 5 goify: fix extra space bug
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/goify/default.nix15
1 files changed, 8 insertions, 7 deletions
diff --git a/krebs/5pkgs/goify/default.nix b/krebs/5pkgs/goify/default.nix
index e2849b5c7..9c44aaeeb 100644
--- a/krebs/5pkgs/goify/default.nix
+++ b/krebs/5pkgs/goify/default.nix
@@ -1,17 +1,18 @@
{ pkgs, ... }:
-pkgs.writeDashBin "goify" ''
+pkgs.writeBashBin "goify" ''
set -euf
GO_HOST=''${GO_HOST:-go}
while read line; do
- echo "$line" | sed -E 's|https?://\S*|\n&\n|g' | while read word; do
- if echo "$word" | grep -Eq ^https?:; then
- ${pkgs.curl}/bin/curl -Ss -F uri="$word" http://"$GO_HOST" | tr -d '\r'
+ echo "$line" | sed 's|https\?://\S*|\n&\n|g' | while read word; do
+ if echo "$word" | grep -q '^https\?:'; then
+ ${pkgs.curl}/bin/curl -Ss -F uri="$word" http://"$GO_HOST" \
+ | tr -d '\r'
else
- echo "$word";
- fi;
- done | sed '/^$/d' | tr '\n' ' '; echo;
+ echo "$word"
+ fi
+ done | grep . | tr '\n' ' '; echo
done
''