MrDuk
MrDuk

Reputation: 18332

Why does curl blank out my output file upon completion?

I'm trying to do: curl https://www.biblegateway.com/passage/?search=Hebrews%202:17-18&version=ESV -o test.out

However, when this completes (after I hit Enter), the file is blank. The curl doesn't terminate until I press Enter.

All I really want (I think), is just the og:description section:

<meta property="og:description" content="For this reason he had to be made like them, fully human in every way, in order that he might become a merciful and faithful high priest in service to God, and that he might make atonement for the sins of the people. Because he himself suffered when he was tempted, he is able to help those who are being tempted."/>

Upvotes: 0

Views: 63

Answers (1)

nos
nos

Reputation: 229324

Because the URL contains special characters that's interpreted by the shell. In particular the & launches the command (everything to the left of the & ) in the background, then the version=ESV to the right of that & is shell syntax for setting a variable.

Short story, quote the URL so the shell doesn't interpret it:

curl 'https://www.biblegateway.com/passage/?search=Hebrews%202:17-18&version=ESV' -o test.out

Upvotes: 2

Related Questions