Though this isn't especially my bailiwick :-) I believe you may
need to make a couple of adjustments.
First, this is the heredoc variable assignment form I'm familiar with:
========
SQL=$(cat <<-EOF
INSERT INTO mytable
(\`field1\`, \`field2\`)
VALUES
('val1', 'val2')
EOF
)
echo "$SQL"
========
Next, you'll need to change "SQL" on line 6 to "EOF" (so the
heredoc start & end delimiters match), and also escape the
backticks on line 3 to keep the shell from trying to interpret
them, and I believe that should do the job. :-)
Regards,
Patrick Woolsey
==
Bare Bones Software, Inc. <http://www.barebones.com/>
On 1/22/19 at 5:01 PM, [email protected] (Gustave
Stresen-Reuter) wrote:
Hi,
I'm trying to test a heredoc in a worksheet but I can't quite work out the
syntax.
All of the examples I've seen look like this:
cat << EOF > SQL
INSERT INTO mytable
(`field1`, `field2`)
VALUES
('val1', 'val2')
SQL
echo "$SQL"
But when I try that in a worksheet, the echo is a blank line.
What am I doing wrong?
Thanks in advance.
Ted Stresen-Reuter
--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.