EOF 空格问题

时间:2021-09-22 04:00:30

mysql -u $USER -p${PASSWORD} $DATABASE << EOF >/tmp/dd-$$ 2>/tmp/ddd-$$
select *
from $TABLE;
EOF
cat /tmp/dd-$$ |sed '1d'

执行此test.shell报如下错:

warning: here-document at line 17 delimited by end-of-file (wanted `EOF')

原因是末尾的EOF后面带有空格,EOF前后都不应有空格或其他符号