Skip to content

Commit

Permalink
fix: printHash.sh; replace echo -n, check if $1 is set.
Browse files Browse the repository at this point in the history
  • Loading branch information
gottaeat committed Jul 1, 2021
1 parent 2071abd commit de64bbe
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions printHash.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit de64bbe

Please sign in to comment.