$escape() and $unescape() methods
Essentially, Bash allows one to convert ASCII sequences into their corresponding codes if that string is enclosed within single quotes that follow the $
.
echo $'this\nstring\thas\tspecial\ncodes'
this
string has special
codes
We should support this with an $unescape()
method, like so:
echo $unescape('this\nstring\thas\tspecial\ncodes')
As well as a corresponding $escape()
method that will do the opposite. We could likely re-use logic from the echo
builtin to do this.