in reply to syntax error near unexpected token `)'

It is something related to bash in fact. See QUOTUNG section in the manual:

Enclosing characters in single quotes preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.
  • Comment on Re: syntax error near unexpected token `)'

Replies are listed 'Best First'.
Re^2: syntax error near unexpected token `)'
by vit (Friar) on May 20, 2012 at 17:05 UTC
    Then how to handle a single quote match?
      This sounds more like a bash question to me, but you can replace single quotes with \N{APOSTROPHE} or \x27. In bash you can do it like this:
      $ echo 'aa'"'"'bb'; aa'bb

        Alternatively and one shorter: Change ' to '\''.

        $ echo 'aa'\''bb'; aa'bb