Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
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
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

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.