#!/bin/bash filename=$1 date=`date +%Y%m%d` usage () { echo "Usage: `basename $0` filename" } if [ -z "$filename" -a ! -f "$filename" ]; then usage exit 1 fi rev=0 backup="$filename.$date.$rev" while [ -f $backup ]; do let rev+=1 backup="$filename.$date.$rev" done cp $filename $backup exit $?
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
backup files (See related posts)
You need to create an account or log in to post comments to this site.
Related Posts
» Measure the daily number of ... in email date perl shell bash mime day mailbox
» Bash script to perform initi... in rails shell svn bash script
» Cache a local copy of Google... in shell google bash script urchin sh googleanalytics analytics
» Notifications from shell scr... in shell osx mac bash script unix gui notification
» Make a file backup adding da... in shell bash backup
» Terminal window commands in shell osx mac bash unix code osascript text window terminal color title bar escape background ansi
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails