diff options
| author | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-07-05 21:04:05 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-05 21:04:05 +0300 |
| commit | 164623d58e1e11389ec6d39c2d95146438fd14b8 (patch) | |
| tree | 3ae07491806966639fa71f1a202cbc04d8c48abd | |
| parent | Merge pull request #1187 from mssx86/musl_fix (diff) | |
| parent | fix: printHash.sh; replace echo -n, check if $1 is set. (diff) | |
| download | re3-164623d58e1e11389ec6d39c2d95146438fd14b8.tar.gz | |
Merge pull request #1188 from mssx86/echo_to_printf
fix: printHash.sh; replace echo -n, check if $1 is set.
| -rwxr-xr-x | printHash.sh | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/printHash.sh b/printHash.sh index e7d6f018..213d9353 100755 --- a/printHash.sh +++ b/printHash.sh @@ -1,12 +1,14 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh +if [ -z "${1}" ] + then + printf "%s\n" "Input the path to the file for writing the commit hash to." + else + printf "%s" "#define GIT_SHA1 \"" > $1 -> $1 + if (command -v "git" >/dev/null) then + git rev-parse --short HEAD | tr -d '\n' >> $1 + fi -echo -n "#define GIT_SHA1 \"" > $1 - -if (command -v "git" >/dev/null) then -git rev-parse --short HEAD | tr -d '\n' >> $1 + printf "%s\n" "\"" >> $1 + printf "%s\n" "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1 fi - -echo "\"" >> $1 -echo "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1
\ No newline at end of file |
