forked from c-h-david/rrr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.sh
executable file
·34 lines (29 loc) · 1.11 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/bash
#*******************************************************************************
#version.sh
#*******************************************************************************
#Purpose:
#This script allows determining the version of RRR that is being used, but only
#if git is installed and if the RRR git repository is present. Otherwise
#'unknown' is used.
#Author:
#Cedric H. David, 2016-2018
#*******************************************************************************
#Check if a program exists and perform tasks
#*******************************************************************************
if type 'git' > /dev/null; then
#git is installed
if git rev-parse --git-dir > /dev/null 2>&1; then
#this is a git repository
git describe
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
#*******************************************************************************