On Wed, 2003-09-10 at 12:28, john jonas wrote: > I want to write a script to do backups for the people > here at work (they just layed me off so I'm not going > to be here to back stuff anymore). I want to write a > simple thing that will tar up a directory and name it > by the date. I just can't figure out how to pass the > current date to tar. any suggestions on how to do > something like this: > > #!/bin/bash > tar -czf /backups/code_backup-[todays date].tar.gz > /some directory
tar -czf /backups/code_backup-`date`.tar.gz /some/directory you can give date some options to make it print out a more filename friendly date. Man date to see the different output options (but don't date any men). > > Then I also want to use scp to copy this backup to > another machine. How can I pass a password to scp on > the command line? something like: > > scp /backups/code_backup-[todays date].tar.gz > [EMAIL PROTECTED]/backups/. You could set up host keys so you don't need passwords. If you are interested in this let us know and someone can help. Bryan ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
