in reply to Re: Re: Simple Backup Script
in thread Simple Backup Script
While there are some complex things you could do with it, for this problem, you shouldn't need much more than writing out the same commands you would give on a command line, plus a few variables.
#!/bin/sh date=`date +%Y%m%d%k%M%S` path=$1 # Path to use is given on the command line # Use last directory in ${path} as the filename to save # to. (Could use awk or something else here, but I'm # more familer with Perl). # save_file=`perl -e '$file=pop; $file=~m!/(.*)$!; print $1' ${path}` tar -zxf ${save_file}-${date}.tar.gz ${path}
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|