LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   new to shell programming (https://www.linuxquestions.org/questions/debian-26/new-to-shell-programming-348913/)

bluetwist 08-01-2005 12:47 PM

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!

saman007uk 08-01-2005 12:52 PM

Look into the "mysql" command:
Code:

man mysql

bluetwist 08-01-2005 01:22 PM

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

saman007uk 08-01-2005 03:56 PM

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


All times are GMT -5. The time now is 02:44 PM.