Last active
August 29, 2015 14:07
-
-
Save tripleee/f085ae3d4b7650b33c67 to your computer and use it in GitHub Desktop.
Create backups with successively more tildes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source this file | |
bak () { | |
# "local" is a Bashism -- comment out for POSIX | |
local f | |
for f; do | |
test -e "$f~" && bak "$f~" | |
mv "$f" "$f~" | |
done | |
} | |
kab () { | |
local f | |
for f; do | |
case $f in *'~') mv -v -i "$f" "${f%'~'}" || break;; esac; | |
test -e "$f~" && kab "$f~" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment