Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
yesterday="2010-06-23 00:00:00"
today="2010-06-24 00:00:00"
mywhere="lastupdate>'$yesterday' and lastupdate<'$today'"

mysqldump $param ticket --no-create-info --where=\"$mywhere\"

The last line of above shell script would return something like this...

+ mysqldump -uroot -d --compact ahmadpur ticket --no-create-info --where="lastupdate>'2010-06-23 00:00:00' and lastupdate<'2010-06-24 00:00:00'"
mysqldump: Couldn't find table: "00:00:00'"

There is an error in the mysqldump command execution. But if I copy paste the same line, it runs successfully. Do I need to escape the spaces in shell script output? if yes, how?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted
mysqldump $param ticket --no-create-info --where="$mywhere"

(do not escape double quotes in --where="$mywhere")

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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