Mercurial > ec-dotfiles
diff setup @ 135:6a110770a756
A bit more sanity testing.
author | Edho Prima Arief <edho@myconan.net> |
---|---|
date | Tue, 01 Nov 2011 22:40:21 +0700 |
parents | 70928bbbd6cb |
children | 719b0687d974 |
line wrap: on
line diff
--- a/setup Mon Oct 31 11:54:49 2011 +0700 +++ b/setup Tue Nov 01 22:40:21 2011 +0700 @@ -44,17 +44,22 @@ } _rc() { + if test -z "${3}" || test -z "${2}" || test -z "${1}"; then + _echo "Invalid command." + return + fi _srcfile="${rcdir}/${2}" _dstfile="${HOME}/${3}" if test ! -h "${_dstfile}"; then if test -f "${_dstfile}"; then cp "${_dstfile}" "${_dstfile}.bak" + _echo "${_dstfile} backed up to ${_dstfile}.bak" elif test -d "${_dstfile}"; then cp -r "${_dstfile}" "${_dstfile}.bak" + _echo "Directory ${_dstfile} backed up to ${_dstfile}.bak" fi - _echo "${_dstfile} backed up to ${_dstfile}.bak" fi - rm -f "${_dstfile}" + rm -rf "${_dstfile}" case "${1}" in install) ln -fs "${_srcfile}" "${_dstfile}"