The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
backup shell script, need some tips. iNetForce Shell Programming and Scripting 1 03-28-2008 11:08 AM
Check backup file size on backup tape ayhanne UNIX for Dummies Questions & Answers 0 10-25-2007 08:41 AM
Shell Script for RMAN Backup shaan_dmp Shell Programming and Scripting 1 05-08-2007 02:56 AM
Shell script on Oracle hot backup got an error oradbus UNIX for Advanced & Expert Users 1 01-03-2006 08:35 AM
Help with a backup shell script Dingosatemypant UNIX for Dummies Questions & Answers 1 11-04-2005 03:45 AM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-03-2008
Registered User
 

Join Date: Jan 2008
Posts: 6
Shell Script backup a file ?

could you please find a solution for this

script that backup a file. The file name to backup should be provided as input parameter, the backup file should have the same file name with the extension ".bak". If the user provides no input parameter, the script should display an error message. If there is an input file name, but it does not exist, the script should display an error message. If the input file exists, the script should create the backup file and overwrite any existing backup file with the same name.
Forum Sponsor
  #2 (permalink)  
Old 02-03-2008
mirusnet's Avatar
Registered User
 

Join Date: Dec 2007
Posts: 122
Code:
#! /bin/sh

if [ "$#" -eq 0 ]
then 
        exit 1;
fi

cp ${1} "${1}.back"
exit 0
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0