forked from c-h-david/shbaam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.sh
executable file
·34 lines (29 loc) · 1.13 KB
/
version.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
#*******************************************************************************
#version.sh
#*******************************************************************************
#Purpose:
#This script allows determining the version of SHBAAM that is being used, but
#only if git is installed and if the SHBAAM git repository is present.
#Otherwise 'unknown' is used.
#Author:
#Cedric H. David, 2017-2018
#*******************************************************************************
#Check if a program exists and perform tasks
#*******************************************************************************
if command -v git > /dev/null 2>&1; then
#git is installed
if git rev-parse --git-dir > /dev/null 2>&1; then
#this is a git repository
git describe --always
else
#this is not a git repository
echo "unknown, NOT a git repository"
fi
else
#git is not installed
echo "unknown, git NOT installed"
fi
#*******************************************************************************
#end
#*******************************************************************************