Created
July 4, 2012 06:00
-
-
Save editnuki/3045638 to your computer and use it in GitHub Desktop.
第1引数のディレクトリを第2引数のディレクトリに$date.tar.gzにリネームして保存するシェルスクリプト
This file contains hidden or 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
#!/bin/bash | |
DIR=$1 | |
BACKUPDIR=$2 | |
DATE=`date +"%Y%m%d%H%M"` | |
[ -e $DIR ] || { echo "not found $DIR" ; exit 1 ; } | |
[ ! -e $BACKUPDIR/$DATE.tar.gz ] || { echo "$DATE.tar.gz is existence" ; exit 1 ; } | |
TARGZIP=`tar zcvfP $DIR/$DATE.tar.gz $DIR` | |
REMOVE=`mv $DIR/$DATE.tar.gz $BACKUPDIR` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment