import re


def split_cmds(sec):
    """Splits a command string at logout and bash shell calls."""
    
    cmd_array = []
    cmd_str = ""
    for c in sec.cmds.split('\n'):
        cmd_str += c + '\n'
        if re.search(r".+bash\s+--login", c) or \
            re.search(r"\blogout\b", c):
            cmd_array.append(cmd_str)
            cmd_str = ""
    if cmd_str.strip() != "":
        cmd_array.append(cmd_str)
    return cmd_array