dotfiles/.local/bin/scripts/bak

11 lines
200 B
Text
Raw Normal View History

#!/bin/sh
2021-07-04 18:20:36 +02:00
suffix="${2:-bak}"
2021-07-04 21:56:12 +02:00
orig="${1%%.$suffix}"
echo $orig
if test -e "$orig.$suffix"
then
test -e "$orig" && mv -v "$orig" /tmp
mv -vn "$orig.$suffix" "$orig"
else mv -vn "$1" "$1.$suffix"
fi