shell - Use variable in mysql CL -


is possible use shell variable in mysql query via command line? want :

$ var='test'  $ mysql -e 'insert table (text) value ($var);' database 

it didn't seems work, when use ${var}

any idea of how can that?

i have stay in shell, running through jenkins 'execute shell'

so, of comment, manage it.

the link explanations of quotes in mysql explain everything.

the solution :

$ var='test' $ mysql -e "insert table (text) value ('$var');" database 

Comments