Im making a script where I connect to a database, look for a value and then if that value returned something then I will do something else.ip=$(variable is defined here)Then I connect to the MYSQL database using:/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot --password=*However, this takes me to another prompt, and I need to run another command from that, I can't get it to work.I tried this:/Applications/MAMP/Library/bin/mysql MYSQL argumens;;and just:MYSQL arguments;None of these work and I have to pass a variable to it, what can I do now?
How do run MYSQL scripts from a shell script with bash variables?
bash;shell script;mysql
You can do something like this:#! bin/bashselectvar=SELECT * FROM test;mysql --user=root --password=mypass database << eof $selectvareof