script: function style
This commit is contained in:
parent
435ea0ce45
commit
43d38fac70
@ -3,9 +3,14 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
fetch_top_words() {
|
||||||
|
local url
|
||||||
|
local basedir
|
||||||
|
|
||||||
url="${1:-}"
|
url="${1:-}"
|
||||||
basedir=$(dirname "$0")
|
basedir=$(dirname "$0")
|
||||||
|
|
||||||
|
|
||||||
if [[ "${url:-}" = "" ]]; then
|
if [[ "${url:-}" = "" ]]; then
|
||||||
grep --only-matching --extended-regexp '[a-zA-Z]{3,}' "$basedir/README.md" \
|
grep --only-matching --extended-regexp '[a-zA-Z]{3,}' "$basedir/README.md" \
|
||||||
| tr '[:upper:]' '[:lower:]' \
|
| tr '[:upper:]' '[:lower:]' \
|
||||||
@ -22,3 +27,5 @@ else
|
|||||||
| uniq --count \
|
| uniq --count \
|
||||||
| sort -n
|
| sort -n
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
fetch_top_words "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user