Add logic to check for existence of files before interacting with them

if ${rcvar} or ${rcvar}.new don't exist, we can't rm/mv them.
This commit is contained in:
Jake Guffey 2012-09-19 17:16:00 -04:00
parent 34ca94ffa2
commit a1793f66ff
1 changed files with 2 additions and 2 deletions

View File

@ -36,6 +36,6 @@ fi
rcvar=$(cat "$__object/explorer/rcvar")
# --state absent, so ensure that .new doesn't exist and that conf is renamed to .old
echo rm \"${rcvar}.new\"
echo mv \"${rcvar}\" \"${rcvar}.old\"
echo "[ -f \"${rcvar}.new\" ] && rm \"${rcvar}.new\""
echo "[ -f \"${rcvar}\" ] && mv \"${rcvar}\" \"${rcvar}.old\""