0

I want to make bash alias to run mysql query via ssh

ssh [email protected]  "mysql wp-theme -e 'DELETE * FROM wp_options where option_name like \'%_transient%\''";

but problem is with part \'%_transient%\' where i tried to escape '

I got error

bash: -c: line 0: unexpected EOF while looking for matching `''
bash: -c: line 1: syntax error: unexpected end of file
2
  • 1
    Can you try changing the \ to \\ as I think I saw something about these being interpreted twice (once for shell and once for SQL). Commented Jun 12, 2017 at 9:14
  • Hmm i still got same errors with ssh [email protected] "mysql wp-theme -e 'SELECT * FROM wp_options where option_name like \\'%_transient%\\';'" Commented Jun 12, 2017 at 9:21

1 Answer 1

1

After a while I found the solution

ssh [email protected]  "mysql wp-theme -e 'DELETE FROM \`wp_options\` where \`option_name\` like \"%_transient%\";'"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.