Could anyone explain to me why
echo 'test \'hi\'' > test doesn't work? It doens't write
hi to the file
test. The single quotes seem to be properly escaped, aren't they?
You can't embed single quotes within single-quoted strings. Instead, you have to place and escape the single quotes outside of the quoted string.