import re


def extract_command_from_litani_command(command):
    """Extract the shell command from a litani command."""

    command = command.strip()
    match1 = re.search(' --command +"([^"]*)"', command)
    match2 = re.search(" --command +'([^']*)'", command)
    match3 = re.search(' --command +([^ ]*)', command)
    cmd1 = match1.group(1).strip() if match1 else None
    cmd2 = match2.group(1).strip() if match2 else None
    cmd3 = match3.group(1).strip() if match3 else None

    cmd = cmd1 or cmd2 or cmd3
    return cmd if cmd else command