diff options
author | mssx86 <mss@tutanota.de> | 2021-07-01 19:14:46 +0200 |
---|---|---|
committer | mssx86 <mss@tutanota.de> | 2021-07-01 19:14:46 +0200 |
commit | de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f (patch) | |
tree | a86b46b027f3889e6dad6765496e95284f3d2f9f | |
parent | zero out work_buff before writing padding in save (diff) | |
download | re3-de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f.tar re3-de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f.tar.gz re3-de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f.tar.bz2 re3-de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f.tar.lz re3-de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f.tar.xz re3-de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f.tar.zst re3-de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f.zip |
-rwxr-xr-x | printHash.sh | 24 |
1 files changed, 13 insertions, 11 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 - -> $1 - -echo -n "#define GIT_SHA1 \"" > $1 - -if (command -v "git" >/dev/null) then -git rev-parse --short HEAD | tr -d '\n' >> $1 +#!/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 + + if (command -v "git" >/dev/null) then + git rev-parse --short HEAD | tr -d '\n' >> $1 + fi + + 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 |