There is a column in my table with string values, but the strings have spaces
in them. I want to read the unique column values into an array in my bash
script, so I can use these values in a separate query on this table. How do I
get the values into an array?
For example, the column teams in my table
| team |.....
and I want to create the equivalent statement, but using what I find in the
declare -a TEAMS=("Red Sox" "Chicago Colleens" "Athletics" "Kenosha Comets")
I tried the following:
declare -a TEAMS=(`mysql -u "$USER" -h "$HOST" --password="$PASSWORD" -D
"$DATABASE" -B --disable-column-names --exec "select distinct team from
registered order by team"`)
but I get the following array (using the data above)
("Red" "Sox" "Chicago" "Colleens" "Athletics" "Kenosha" "Comets")
How do I either (1) add quotes around each row entry returned so I get the
right array, or (2) fill the array in a different way?
Phillips Marketing, Inc
480 945-9197 fax