Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
backup a file with SHELL SCRIPT
Name: Justin Date: January 23, 2003 at 12:51:21 Pacific OS: Solaris 8 CPU/Ram: SPARC
Comment:
Hi, I was wondering if anybody knew how to make a shell script that will make a backup of a file example (mv out out.bak) but the next time you run the script i want the original backup file to still be there.
#!/bin/bash # Copy mc2.xml to cmd.cmd and run perl script for out file
echo echo "Your current directory is: " pwd echo echo "Backing up old output file..." cp out out.bak rm -rf out cp ~/xml/mc2.xml ~/xml/html/cmd.cmd echo "Copying MC2 and parsing output..." perl index.cgi cmd.cmd > out echo "Finished making file 'out'"
-----------
I would like to be able to keep the original backup file out.bak and next time I run the script move the newer out file to out.bak1 or somthing along those lines.
Summary: In a ksh script I get a file with a path from another program. I need to create the file and it's directories. I know mkdir -p can make the dirs but how to get the dirs without the filename? TIA Keith...
Summary: You did not explain whether or not you get a new file each day (which is what I assume) or if you are appending to an existing file. Using the awk solution will only increment from 1 to the number of...
Summary: I solved my issue with another one i filed: 'comparing 2 files with shell script' in this forum. Thanks for your assistance. Suresh sureshht...