quote


Description:

public string quote (string unquoted_string)

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 [func@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 [func@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

a literal string

Returns:

quoted string


Namespace: GLib.Shell
Package: glib-2.0