LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-06-2011, 09:20 AM   #1
sebastiaankop
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
Loop with variables


Hi all,

I'm looking for a way to do this:

-Starting point-

Multiple sets of variables each with its own host, database, user, password and destination for the backup.

MySQL dump command with the variables in it.

-Run script-

Take set ONE of variables with only one host, database, user password and destination.

Use these variables to run MySQL dump for backup.

Take set TWO of variables with only one host, database, user password and destination.

Use these variables to run MySQL dump for backup.

Take set THREE of variables with only one host, database, user password and destination.

Use these variables to run MySQL dump for backup.

After all the sets of variables have run with the backup command then stop running.

-End script-

I was busy looking for loops but they all seem to work with numbers.

Maybe i'm just not that experienced.

Thank you for your help.

Greetings,

Sebastiaan.
 
Old 01-06-2011, 09:26 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello again,

I'm sure you'll get it working after some time, considering you're new and learning Bash. To get an idea of how to go about what you want you can have a look at this AutoMySQLBackup script that does what you want (and more).

Good starting points to learn Bash:
Bash Guide for Beginners
Advanced Bash Scripting Guide

Kind regards,

Eric
 
Old 01-06-2011, 09:35 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,549
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Do not forget Bash Reference Manual.

 
  


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
Loop with 2 variables tensigh Programming 7 11-17-2009 08:07 PM
[SOLVED] for loop with variables musonio Linux - General 4 11-06-2009 03:45 PM
Why does this loop clear variables? novaraz Programming 6 10-25-2008 09:40 AM
Using for loop on 2 variables muazfarooqaslam Linux - Newbie 8 02-01-2008 09:03 AM
How to check variables in a FOR loop? richikiki Programming 6 07-10-2006 04:57 AM


All times are GMT -5. The time now is 11:15 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration