@classmethod
    def _shell_command_list_to_single_command(cls, commands):
        if not isinstance(commands, list):
            return None

        # We should join the commands with double ampersands UNLESS the command already ends with a single ampersand.
        # A semicolon (or a double ampersand) is invalid syntax after a single ampersand.
        sanitized_commands = []
        for command in commands:
            if command is None:
                # skip `None` command in the commands list
                continue
            stripped_command = command.strip().rstrip(';')
            # If the command ends with an ampersand (single or double) we can leave the command alone (empty postfix)
            postfix = ' ' if stripped_command.strip().endswith('&') else ' && '
            sanitized_commands.append(stripped_command + postfix)

        # '&&' must not be appended to the command for the last shell command. For the sake of homogeneity of the
        # loop above, we just strip out the '&&' here.
        joined_commands = ''.join(sanitized_commands).strip()

        if joined_commands.endswith('&&'):
            joined_commands = joined_commands.rstrip('&').strip()

        return joined_commands
Returns a frozenset of variables used in given terms.
dataset/ETHPy150Open box/ClusterRunner/app/master/job_config.py/JobConfig._shell_command_list_to_single_command--crossover with--dataset/ETHPy150Open Microsoft/ivy/ivy/logic_util.py/used_variables