Nico Laemers
Nico Laemers

Reputation: 23

mysql in bash with variable

How can i parse a variable in a mysql update statement in a bash script?

i have this but its not going to work

mysql -h HOST -u USERNAME -pUGUESIT -D DATABASE -bse "DELETE FROM table WHERE Position='" . $4 ."'; DELETE FROM table WHERE Instance='" . $4 . "';" 

ofcourse username and pass etc are correct but not for public. The question is how I can use the $4 in the statement...

Thanks in advance!

Upvotes: 2

Views: 9331

Answers (1)

Ike Walker
Ike Walker

Reputation: 65537

You should be able to do it like this:

"DELETE FROM table WHERE Position='$4'; DELETE FROM table WHERE Instance='$4';" 

Upvotes: 5

Related Questions