LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-01-2005, 12:47 PM   #1
bluetwist
LQ Newbie
 
Registered: Jul 2005
Posts: 15

Rep: Reputation: 0
Question new to shell programming


Hi, Friends
I am a newbie for the shell programming world. I can use bash to deal with files I needed, then I need to communicate with database (MySql) based on those files in order to store some information about those files. How can I achieve this? Do I need to use other scripting language such as perl, python, or ruby etc. And how to do this in shell. Some example code will be appreciated!

Thanks for your help!
 
Old 08-01-2005, 12:52 PM   #2
saman007uk
Member
 
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 364

Rep: Reputation: 33
Look into the "mysql" command:
Code:
man mysql
 
Old 08-01-2005, 01:22 PM   #3
bluetwist
LQ Newbie
 
Registered: Jul 2005
Posts: 15

Original Poster
Rep: Reputation: 0
To saman007uk

Hi, saman007uk
Thank you for your response. Running MySql under shell is an interactive mode. I am wondering in my shell script after dealing with files, then connetc to the database and do something related to the files. How can I do this?

Thanks
 
Old 08-01-2005, 03:56 PM   #4
saman007uk
Member
 
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 364

Rep: Reputation: 33
You can generate all the SQL code in one go, put it in a file and then run as follows:

Code:
mysql databse-name << file-containg-sql-code.sql
May I recommend the following book if you are new to shell programming? Amazon: Classical Shell Scripting (the link may not work, but you can do a search in Amazon.com

Last edited by saman007uk; 08-01-2005 at 04:01 PM.
 
  


Reply



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
Shell programming quan Programming 8 11-27-2005 07:46 PM
shell programming qerf Linux - Newbie 5 11-06-2005 05:28 PM
programming shell tuls Slackware 3 08-24-2005 05:58 PM
Shell Programming eantoranz Linux - Networking 2 06-02-2005 11:21 AM
shell programming shadowsurfer Linux - Newbie 3 09-09-2004 09:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:20 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
Open Source Consulting | Domain Registration