LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-27-2010, 04:41 AM   #1
disca
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
bash and arrays


Hi guys,
i will be quick, im trying to send a mysql query output into an array ie:

Code:
declare -a HD
HD=`echo "USE db; SELECT uid FROM user" | mysql -u $login -p$pwd -h $dbhost -B`
echo ${#HD}
those vars in mysql connection are previously and correctly assigned.
but got an error

script.sh: 2: declare: not found

i found another post regarding this but it's closed and no help at all
thanks in advance.

disca

Last edited by disca; 07-27-2010 at 04:47 AM.
 
Old 07-27-2010, 04:48 AM   #2
aizkorri
Member
 
Registered: Feb 2002
Location: Basque Country
Distribution: Fedora 14, Ubuntu 11.10
Posts: 425
Blog Entries: 1

Rep: Reputation: 36
Well, I think it could be not running bash, but some other,
you could try doing
bash ./script.sh
 
Old 07-27-2010, 05:26 AM   #3
disca
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Original Poster
Rep: Reputation: 0
my bad, missed a / in interpreter.

sorry for wasting your time
 
Old 07-27-2010, 08:26 AM   #4
aizkorri
Member
 
Registered: Feb 2002
Location: Basque Country
Distribution: Fedora 14, Ubuntu 11.10
Posts: 425
Blog Entries: 1

Rep: Reputation: 36
no prob :-)
 
  


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
Bash - Arrays and the for-loop Orangutanklaus Linux - General 2 10-23-2009 01:04 PM
[SOLVED] Bash: all variables are arrays. Why? catkin Programming 5 09-09-2009 08:52 AM
problem with arrays in bash igor.R Linux - Newbie 8 04-18-2009 11:05 AM
Initializing arrays in bash Raht Programming 1 03-12-2009 12:33 PM
Bash Arrays Simon256 Programming 2 02-17-2009 01:39 PM


All times are GMT -5. The time now is 03:26 PM.

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