user216171
user216171

Reputation: 1726

How to pass HTML to shell?

I'm trying to pass HTML of an existing website to shell as a parameter for a script, but I'm not sure how to properly escape it.

Enclosing it in single or double quotes doesn't work as there are characters such as '$' or '!' , which the shell interprets literally.

Upvotes: 1

Views: 289

Answers (1)

Gregor
Gregor

Reputation: 4434

It's best practice to pipe files into shell scripts for this case.

Easy version: write out the content into a temporary file and invoke your shell script with the filename. Your shell script reads the input and deletes the file afterwards.

If you pipe the input into the file, you don't need the temporary file.

Upvotes: 1

Related Questions