Back dat UP

Tony's Wiki | bash

I wrote a script to back a file up before editing it, although, it will also have other uses. Of course, while editing in VIM, I can always :w the file to another name, just, you know, in case I forget or something, I can back up a file before I even start to write to it.

This is what that script looks like:

#!/bin/bash
 
filedate=$(date +%m%d%y%H%M%S)
 
cp $* $*.$filedate
 
echo copied to $*.$filedate
exit 0

tonybaldwin 2012.01.03.22.02


~~DISQUS~~