From 743a2656af40537faac5ae5e8bd4ab901a948ee7 Mon Sep 17 00:00:00 2001 From: Morgan Wattiez Date: Mon, 3 Sep 2018 09:47:54 +0200 Subject: [PATCH] allow to run scripts from any folder --- count_links.sh | 4 +++- top_authors.sh | 4 +++- top_domains.sh | 4 +++- top_words.sh | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/count_links.sh b/count_links.sh index aa1be78..e705593 100755 --- a/count_links.sh +++ b/count_links.sh @@ -1 +1,3 @@ -cat README.md | cut -d'(' -f2 | cut -d')' -f1 | egrep "^http*" | sort -u | wc -l +#/usr/bin/env bash +BASEDIR=$(dirname "$0") +cat "$BASEDIR/README.md" | cut -d'(' -f2 | cut -d')' -f1 | egrep "^http*" | sort -u | wc -l diff --git a/top_authors.sh b/top_authors.sh index 321bbd1..bf6de24 100755 --- a/top_authors.sh +++ b/top_authors.sh @@ -1 +1,3 @@ -grep http README.md | cut -d '[' -f 2 | cut -d ']' -f 1 | sed 's/\*//g' | grep -v "/" | sort | uniq -c | sort -n +#/usr/bin/env bash +BASEDIR=$(dirname "$0") +grep http "$BASEDIR/README.md" | cut -d '[' -f 2 | cut -d ']' -f 1 | sed 's/\*//g' | grep -v "/" | sort | uniq -c | sort -n diff --git a/top_domains.sh b/top_domains.sh index d5d0895..91ed15d 100644 --- a/top_domains.sh +++ b/top_domains.sh @@ -1 +1,3 @@ -cat README.md | cut -d'(' -f2 | cut -d')' -f1 | egrep "^http*" | awk -F/ '{print $3}' | sort | uniq -c | sort -n +#/usr/bin/env bash +BASEDIR=$(dirname "$0") +cat "$BASEDIR/README.md" | cut -d'(' -f2 | cut -d')' -f1 | egrep "^http*" | awk -F/ '{print $3}' | sort | uniq -c | sort -n diff --git a/top_words.sh b/top_words.sh index 9975698..3f10f8e 100644 --- a/top_words.sh +++ b/top_words.sh @@ -1 +1,3 @@ -grep -o -E '[a-zA-Z]{3,}' README.md | tr A-Z a-z | sort | uniq -c | sort -n +#/usr/bin/env bash +BASEDIR=$(dirname "$0") +grep -o -E '[a-zA-Z]{3,}' "$BASEDIR/README.md" | tr A-Z a-z | sort | uniq -c | sort -n