LinuxQuestions.org
Visit Jeremy's Blog.
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 11-18-2003, 01:02 PM   #1
merkelt
LQ Newbie
 
Registered: Sep 2003
Location: Boulder, CO
Distribution: RedHat
Posts: 6

Rep: Reputation: 0
Scripting in Baxh with MySQL


In my script, I am running a query against mysql, which works great, but I am having trouble storing that information in a variable.

#bash shell
#This statement works fine by itself
mysql -u user1 -ppass1 -s -e "select count(*) as z from db1.table1 where username='$1' and preference='block_all'"

#bash shell
#This is what I want to do, but it doesn't work
variable1 = mysql -u user1 -ppass1 -s -e "select count(*) as z from db1.table1 where username='$1' and preference='block_all'"asdfa

Any help getting this infor into a variable would be greatly appreciated!

Tim
 
Old 11-18-2003, 01:03 PM   #2
merkelt
LQ Newbie
 
Registered: Sep 2003
Location: Boulder, CO
Distribution: RedHat
Posts: 6

Original Poster
Rep: Reputation: 0
The asdfa in my prior post should not be there...don't know how that got there...
 
  


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
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
Bash scripting, mysql, and creating tables. hondaman Linux - General 2 09-25-2005 06:17 AM
Shell scripting: Doing MySQL Dump base on date Swakoo Linux - General 2 09-21-2005 11:23 PM


All times are GMT -5. The time now is 06:58 PM.

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