import re


def cmdstr(cmd):
    """Get a nicely quoted shell command."""
    ret = []
    for arg in cmd:
        if not re.match(r"^[a-zA-Z0-9/_.=-]+$", arg):
            arg = f'"{arg}"'
        ret.append(arg)
    return " ".join(ret)