Bash swap function for swapping two files
Put following function definition code into ~/.bashrc file: function swap() { local TEMPFILENAME=tempfile.$$ mv "$1" $TEMPFILENAME && mv "$2" "$1" && mv $TEMPFILENAME $2 } Usage: swap FILE1 FILE2 This solution was originally found at: https://stackoverflow.com/questions/1115904/shortest-way-to-swap-two-files-in-bash/1115909#1115909