Browse code

git-sync.sh - v1.1 - Bug in test_dep function corrected

Fred authored on14/09/2014 20:34:57
Showing1 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 # Title: git-sync.sh
3
-# Version: 1.0
3
+# Version: 1.1
4 4
 # Author: Frédéric CHEVALIER <fcheval@txbiomedgenetics.org>
5 5
 # Created in: 2014-09-03
6 6
 # Modified in: 2014-09-14
... ...
@@ -20,6 +20,7 @@ aim="Synchronize files from git server (master branch) on this terminal."
20 20
 # Versions #
21 21
 #==========#
22 22
 
23
+# v1.1 - 2014-09-14: test_dep bug corrected
23 24
 # v1.0 - 2014-09-14: git dependency check replaced by wget check (bug) / test_dep function improved / remove comments in list file / check for http path / remove spaces in path / checksum loop corrected
24 25
 # v0.1 - 2014-09-23: dry-run option added / no check certifcate option added for wget
25 26
 # v0.0 - 2014-09-03: creation
... ...
@@ -32,7 +33,8 @@ aim="Synchronize files from git server (master branch) on this terminal."
32 33
 
33 34
 # Dependency test
34 35
 function test_dep {
35
-    if [[ ! $(which $1 &> /dev/null) ]]
36
+    which $1 &> /dev/null
37
+    if [[ $? != 0 ]]
36 38
     then
37 39
         error "Package $1 is needed. Exiting..." 1
38 40
     fi