def quote( *args ):
    """Combine the arguments into a single string and escape any and
    all shell special characters or (reserved) words.  The shortest
    possible string (correctly quoted suited to pass to a bash shell)
    is returned.
    """
    s = "".join( args )
    if _bash_reserved_words.has_key( s ):
        return "\\" + s
    elif s.find( '\'' ) >= 0:
        s1 = '"' + _quote_re1.sub( r"\\\1", s ) + '"'
    else:
        s1 = "'" + s + "'"
    s2 = _quote_re2.sub( r"\\\1", s )
    if len( s1 ) <= len( s2 ):
        return s1
    else:
        return s2
Combine the arguments into a single string and escape any and
    all shell special characters or (reserved) words.  The shortest
    possible string (correctly quoted suited to pass to a bash shell)
    is returned.
    
recipes/Python/577483_Better_quote_module_bash/recipe-577483.py