You have a quoting problem. In order to embed a single quote ('
) into a shell string which is also surrounded in single quotes, you need to switch to a double quoted string:
change:
cmd 'foo "bar 'baz' quux"'
# ^ ^
to:
cmd 'foo "bar '"'"'baz'"'"' quux"'
# ^^^^^ ^^^^^
You can use other escape styles, but this one is portable across all posix shells.