From 54ab8768b6e87b52f642e77171c2eb3b67c26464 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Mon, 27 Sep 2021 15:18:06 -0400 Subject: [PATCH] docs: Add comments to get-version.sh (#4) --- .github/workflows/get-version.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/get-version.sh b/.github/workflows/get-version.sh index 78bc6e1..8eb6ab7 100755 --- a/.github/workflows/get-version.sh +++ b/.github/workflows/get-version.sh @@ -16,7 +16,17 @@ # Pull a tag or version number from versions.txt. +# Get the directory this script is in. dir=$(dirname "$0") +# Get the key we want to look for in versions.txt. +# This is the first (and only) argument to the script. key="$1" +# 1. "cat" will output the text file to stdout. +# 2. "grep" will filter for a line that begins with the desired key, +# and only send matching lines to stdout. +# ("^" is the regex character for "beginning of line") +# 3. "sed" will transform the output of grep by removing everything up to +# and including the colon and space characters, leaving only the value +# as output to stdout. cat "$dir"/versions.txt | grep "^$key:" | sed -e 's/.*: //'