If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Mysql query in script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-02-04, 01:00
mickykt mickykt is offline
Registered User
 
Join Date: Mar 2003
Location: Singapore
Posts: 200
Mysql query in script

Hi guys,

I would like to run a shell script.I want to assign a values from a mysql query within a shell script.As

t = ./mysql -D database -e "select count(*) from tablename;"

so t can contain the number of records in the table and I can run futher in a loop.

The part where I get stuck is when I run the script it says

test_scrpt.sh: line 25: -D: command not found


Please help me on this.

Thnaks
micky
Reply With Quote
  #2 (permalink)  
Old 11-02-04, 03:14
snorp snorp is offline
Registered User
 
Join Date: Apr 2004
Location: Europe->Sweden->Stockholm
Posts: 71
You want to start "mysql" with some parameters and input data from shell_script.sh? Have you tried using backticks?

T = `mysql -e "..."`
Reply With Quote
  #3 (permalink)  
Old 11-02-04, 03:43
mickykt mickykt is offline
Registered User
 
Join Date: Mar 2003
Location: Singapore
Posts: 200
Hi

Thank you very much

God bless you

micky
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On