Skip to content

Commit

Permalink
fswap: quote filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
aspiers committed Jan 14, 2015
1 parent 237de04 commit a1f12e3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/fswap
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ if [ $# != 2 ]; then
exit 1
fi

if ! mv -i $1 $1.fswap.tmp.$$; then
if ! mv -i "$1" "$1.fswap.tmp.$$"; then
echo "Failed to mv $1 $1.fswap.tmp.$$ ! Aborting."
exit 1
fi

if ! mv -i $2 $1; then
if ! mv -i "$2" "$1"; then
echo "Failed to mv $2 $1 ! Restoring $1."
if ! mv -i $1.fswap.tmp.$$ $1; then
if ! mv -i "$1.fswap.tmp.$$" "$1"; then
echo "Failed to restore $1 !!"
fi
exit 1
fi

if ! mv -i $1.fswap.tmp.$$ $2; then
if ! mv -i "$1.fswap.tmp.$$" "$2"; then
echo "Failed to mv $1.fswap.tmp.$$ to $2 !"
exit 1
fi

0 comments on commit a1f12e3

Please sign in to comment.