def shellStr()

in src/filter-j2.py [0:0]


def shellStr(value):
    """
    Formats the given value as a string that can be used within the arguments
    of a shell command.  Characters within the string will be escaped as
    necessary.

    :param value:
        The string to filter.

    :return string:
        A properly escaped shell string containing the provied value.
    """
    return '"' + re.sub(r'([\$`"\\])', r'\\\1', value) + '"'