Récupérer des données mysql dans un script bash
Bonjour,
j'ai essayé de récupérer des informations information de ma table mysql via un script bash
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| #!/bin/bash
hote_db="localhost"
nom_bd="domotique"
login_db="xxxx"
pass_bd="xxxxxx"
format_texte="utf8"
#select_noms_colonnes="id,cmu,exec1,exec2,exec3, macro"
select_noms_colonnes="exec1"
nom_table="bash"
colonne_recherche="cmu"
recherche="A4"
Mysql1="mysql -h$hote_db -D$nom_bd -u$login_db -p$pass_bd -B -N -e "SELECT exec1 FROM $nom_table""
execution1="$Mysql1"
execution2="$Mysql2"
executable="$Mysql3"
macro="$Mysql4"
................. |
Le terminal me rèpond
Code:
1 2 3 4
|
root@debian:/var/www/maison/N4/X10# sh /home/serveur/Domotique/ordres/ordre-a4-test.sh
/home/serveur/Domotique/ordres/ordre-a4-test.sh: 15: exec1: not found
root@debian:/var/www/maison/N4/X10# |
Ma table Mysql est comme ceci
Code:
1 2
| id cmu exec1 exec2 exec3 Macro
4 A4 cm15 A4 On /home/serveur/Domotique/x10/son-confirmation/wav/... a4-on Macro vers d7 |
Comment dois- je faire ?
Merci