1
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?

shantanuo
  • 3,579
  • 8
  • 49
  • 66

1 Answers1

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

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

zed_0xff
  • 149
  • 5