From 38d3bd290a2774996ff01a51c5764665b5da8768 Mon Sep 17 00:00:00 2001 From: Nikolay Kolev Date: Sun, 7 Sep 2014 10:38:52 -0700 Subject: [PATCH] Some generalization --- wshare.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wshare.sh b/wshare.sh index 2fa087c..28f9665 100755 --- a/wshare.sh +++ b/wshare.sh @@ -206,10 +206,17 @@ main () { esac } +assignment () { + local variable="${1:-}" + local value="${2:-}" + + echo "$variable=\"$value\"" +} + do_install () { mkdir -p "$(dirname "$WSHARE_BIN")" rm -f "$WSHARE_BIN" - echo "${BASH_EXECUTION_STRING/WSHARE_VERSION=\"\"/WSHARE_VERSION=\"$(get_latest_version)\"}" > "$WSHARE_BIN" + echo "${BASH_EXECUTION_STRING/$(assignment WSHARE_VERSION)/$(assignment WSHARE_VERSION "$(get_latest_version)")}" > "$WSHARE_BIN" chmod +x "$WSHARE_BIN" }