Unix Shell

Quoting

In POSIX, single quotes cannot be used inside single quotes. It's necessary to close the quote, then either backslash escape the single quote or surround it with double quotes.

e.g.

$ echo 'abc'\''def' abc'def $ echo 'abc'"'"'def' abc'def

Alternatively, use double quotes which also expands all variables:

$ echo "abc'def" abc'def $ echo "abc\"def" abc"def

See https://unix.stackexchange.com/questions/187651/how-to-echo-single-quote-when-using-single-quote-to-wrap-special-characters-in and the referenced Quotes - Greg's Wiki

-- Frank Dean - 7 Sep 2017

Related Topics: LinuxHintsAndTips