| ... | ... |
@@ -1,9 +1,9 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
# Title: git-sync.sh |
| 3 |
-# Version: 1.2 |
|
| 3 |
+# Version: 1.3 |
|
| 4 | 4 |
# Author: Frédéric CHEVALIER <fcheval@txbiomedgenetics.org> |
| 5 | 5 |
# Created in: 2014-09-03 |
| 6 |
-# Modified in: 2014-09-24 |
|
| 6 |
+# Modified in: 2014-12-04 |
|
| 7 | 7 |
# Licence: GPL v3 |
| 8 | 8 |
|
| 9 | 9 |
|
| ... | ... |
@@ -20,6 +20,7 @@ aim="Synchronize files from git server (master branch) on this terminal." |
| 20 | 20 |
# Versions # |
| 21 | 21 |
#==========# |
| 22 | 22 |
|
| 23 |
+# v1.3 - 2014-12-04: warning and error functions improved |
|
| 23 | 24 |
# v1.2 - 2014-09-24: temp file bug corrected / check if local file exist |
| 24 | 25 |
# v1.1 - 2014-09-14: test_dep bug corrected |
| 25 | 26 |
# 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 |
| ... | ... |
@@ -63,14 +64,25 @@ Options: |
| 63 | 64 |
|
| 64 | 65 |
# Error message |
| 65 | 66 |
function error {
|
| 66 |
- echo -e "\e[31mError:\e[00m $1" |
|
| 67 |
- exit $2 |
|
| 67 |
+ if [[ -t 1 ]] |
|
| 68 |
+ then |
|
| 69 |
+ echo -e "\e[31mError:\e[00m $1" |
|
| 70 |
+ exit $2 |
|
| 71 |
+ else |
|
| 72 |
+ echo -e "Error: $1" |
|
| 73 |
+ exit $2 |
|
| 74 |
+ fi |
|
| 68 | 75 |
} |
| 69 | 76 |
|
| 70 | 77 |
|
| 71 | 78 |
# Warning message |
| 72 | 79 |
function warning {
|
| 73 |
- echo -e "\e[33mWarning:\e[00m $1" |
|
| 80 |
+ if [[ -t 1 ]] |
|
| 81 |
+ then |
|
| 82 |
+ echo -e "\e[33mWarning:\e[00m $1" |
|
| 83 |
+ else |
|
| 84 |
+ echo -e "Warning: $1" |
|
| 85 |
+ fi |
|
| 74 | 86 |
} |
| 75 | 87 |
|
| 76 | 88 |
|