Rob Young | digital

Escape single quotes in Bash

Today I discovered a much easier way of escaping single quotes in single quoted Bash strings.

> echo $'foo \'bar\' foo'
foo 'bar' foo

Full details can be found in ANSI C like strings.

From this Stack Overflow Answer.