On Thursday 12 February 2015 23:11:02 Lubomir I. Ivanov wrote:
> git --version 2> /dev/null
> 
> /dev/null is supported in cmd as well.
> 
> if the 'git' command fails, HAS_GIT should contain no value since
> stderr is piped to the null device.

You could do this:

if gitpwd=`git rev-parse --show-toplevel 2>/dev/null`; then
        FULL_VER=`sh "$gitpwd/scripts/get-version" linux`
else
        FULL_VER=`cat .gitversion 2> /dev/null || echo $VERSION`
fi

That checks at the same time for git's presence and that we're in a git 
repository.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to