LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   bash and arrays (https://www.linuxquestions.org/questions/programming-9/bash-and-arrays-822389/)

disca 07-27-2010 04:41 AM

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

aizkorri 07-27-2010 04:48 AM

Well, I think it could be not running bash, but some other,
you could try doing
bash ./script.sh

disca 07-27-2010 05:26 AM

my bad, missed a / in interpreter.

sorry for wasting your time :)

aizkorri 07-27-2010 08:26 AM

no prob :-)


All times are GMT -5. The time now is 02:07 AM.