From 15226cd691cda5e41721d2e902d0529a9ab80bdf Mon Sep 17 00:00:00 2001
From: Saad Jbabdi <saad@fmrib.ox.ac.uk>
Date: Wed, 12 Aug 2009 16:36:56 +0000
Subject: [PATCH] added sanity check

---
 rotate_bvecs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/rotate_bvecs b/rotate_bvecs
index 2e7dec8..e6aade9 100755
--- a/rotate_bvecs
+++ b/rotate_bvecs
@@ -10,6 +10,15 @@ fi
 
 ecclog=$1
 bvecs=$2
+
+if [ -f ${bvecs}_old ];then
+    echo ""
+    echo "Error: Found that ${bvecs}_old already exists"
+    echo "This probably means that you have run this script before."
+    echo "If you want to force this program to run, please remove the file ${bvecs}_old"
+    echo ""
+    exit 1
+done
 /bin/cp ${bvecs} ${bvecs}_old
 #/bin/rm -f ${bvecs}
 
-- 
GitLab