fix: printHash.sh; replace echo -n, check if $1 is set.

This commit is contained in:
mssx86 2021-07-01 20:14:46 +03:00 committed by withmorten
parent c5e896c420
commit 37a43ebf45

View file

@ -1,12 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env sh
if [ -z "${1}" ]
> $1 then
printf "%s\n" "Input the path to the file for writing the commit hash to."
echo -n "#define GIT_SHA1 \"" > $1 else
printf "%s" "#define GIT_SHA1 \"" > $1
if (command -v "git" >/dev/null) then if (command -v "git" >/dev/null) then
git rev-parse --short HEAD | tr -d '\n' >> $1 git rev-parse --short HEAD | tr -d '\n' >> $1
fi fi
echo "\"" >> $1 printf "%s\n" "\"" >> $1
echo "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1 printf "%s\n" "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1
fi