LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-10-2005, 06:33 AM   #1
ice99
Member
 
Registered: Aug 2005
Posts: 51

Rep: Reputation: 15
skipping commands?


here is the problem!

i have script who make some copying....

examle:

echo "enter source name"
read SOURCE

echo "enter destination name"
read DESTINATION

step 1: rsync -Waq /servers/$SOURCE/ /servers/$DESTINATION

step 2: rsync -Waq -e ssh --delete /servers/$SOURCE/ /servers/$DESTINATION

and when i start script first goes STEP1 and then STEP2. byt some times i need to skip STEP 1 and go directly to STEP 2.

how can i do that?

thans in advance!
 
Old 08-10-2005, 07:07 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
I'd use an if statement.

Code:
if [ <condition> ]; then
     rsync -Waq /servers/$SOURCE/ /servers/$DESTINATION
fi
rsync -Waq -e ssh --delete /servers/$SOURCE/ /servers/$DESTINATION
The question is... what determines if you do or don't od the first step?

WARNING: Different shells could have different syntax for the if... code above is bash script.

Last edited by jtshaw; 08-10-2005 at 07:08 AM.
 
Old 08-10-2005, 07:16 AM   #3
ice99
Member
 
Registered: Aug 2005
Posts: 51

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by jtshaw
I'd use an if statement.

Code:
if [ <condition> ]; then
     rsync -Waq /servers/$SOURCE/ /servers/$DESTINATION
fi
rsync -Waq -e ssh --delete /servers/$SOURCE/ /servers/$DESTINATION
The question is... what determines if you do or don't od the first step?

WARNING: Different shells could have different syntax for the if... code above is bash script.
in seccond step i make a clean copy so only the files that have been changed earlier are replaced. and becouse i do this step over the rooter i have little poblems....
 
Old 08-10-2005, 07:36 AM   #4
ice99
Member
 
Registered: Aug 2005
Posts: 51

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by ice99
in seccond step i make a clean copy so only the files that have been changed earlier are replaced. and becouse i do this step over the rooter i have little poblems....
this works fine.

thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound skipping simick1712 Linux - Hardware 1 10-15-2005 07:41 AM
Skipping sound raysr Mandriva 1 02-24-2005 03:31 PM
Sound is Skipping jeffChuck Linux - Hardware 0 01-16-2005 02:46 PM
FC2 test 3 mouse skipping a beat, movie skipping also jang Fedora 1 10-28-2004 07:42 PM
Skipping initializations Buttercups Linux - Newbie 1 07-08-2002 03:22 AM


All times are GMT -5. The time now is 02:29 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration