0

I was trying to run following bash line without success, i've tried many variants of the same line without success, hope somebody see the error.

mysql -u user --password=\m\y\p\a\s\s  -h myhost -e 'kill $(mysql -u user --password=\m\y\p\a\s\s -h myhost -e "show processlist;" | grep Waiting | awk '{print $1}' )'

Basically inside $(...) i'm doing a list of processes in status Waiting and outside that code i'm trying to kill such processes, this is a bash question with $() code that is why i'm posting it here, and i guess there is something with quotes, but i don't know how to fix it.

1

Your quotes are too strong.

Really.

's are "strong" quotes, which is to say that parameter expansions, subshell expansions, history expansions, and the like do not work within them.

$ echo '$(echo foo)'
$(echo foo)
$ echo "$(echo foo)"
foo
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.