How to escape double quotes in Bash Shell Script?

Single quotes(') and backslash(\) are used to escape double quotes in bash shell script.

We all know that inside single quotes, all special characters are ignored by the shell, so you can use double quotes inside it.

echo '"I am studying Machine Learning"'

Output

"I am studying Machine Learning"

You can also use a backslash to escape double quotes.

echo \"RedHat Certified Engineer\"

Output

"RedHat Certified Engineer"

Recommended Posts