diff setup @ 133:fcef92b3f37f

Forgot to check whether the file actually exists.
author Edho Prima Arief <edho@myconan.net>
date Thu, 27 Oct 2011 16:31:43 +0700
parents 66a1d79c4161
children 719b0687d974
line wrap: on
line diff
--- a/setup	Thu Oct 27 16:29:39 2011 +0700
+++ b/setup	Thu Oct 27 16:31:43 2011 +0700
@@ -47,12 +47,15 @@
   _srcfile="${rcdir}/${2}"
   _dstfile="${HOME}/${3}"
   if test ! -h "${_dstfile}"; then
+    _fexist=0
     if test -f "${_dstfile}"; then
       cp "${_dstfile}" "${_dstfile}.bak"
+      _fexist=1
     elif test -d "${_dstfile}"; then
       cp -r "${_dstfile}" "${_dstfile}.bak"
+      _fexist=1
     fi
-    _echo "${_dstfile} backed up to ${_dstfile}.bak"
+    test "${_fexist}" = 1 &&_echo "${_dstfile} backed up to ${_dstfile}.bak"
   fi
   rm -f "${_dstfile}"
   case "${1}" in