Function

GLib-2.0GLibshell_quote

  • Quotes a string so that the shell (/bin/sh) will interpret the quoted string to mean unquoted_string.

    If you pass a filename or other untrusted input to GLib.shell_parse_argv, you should first quote it with this function. This is sufficient to ensure untrusted input cannot ‘break out’ of the quotes. Beware: this only works because GLib.shell_parse_argv is not a real Unix shell. Quoting untrusted input is not an adequate security mechanism when using a real shell.

    The return value must be freed with g_free().

    The quoting style used is undefined (single or double quotes may be used).

    Parameters

    • unquoted_string: string

      a literal string

    Returns string

    quoted string