ios_sequence () {
    if [[ -n "$TMUX" ]]; then
        OUTPUT=$(ios_printf '\033Ptmux;\033\033]'
echo -n "$1" | tr -d '[:space:]'
ios_printf '\a\033\\');
    else
        OUTPUT=$(ios_printf '\033]'
echo -n "$1" | tr -d '[:space:]'
ios_printf '\a');
    fi;
    if [ -t 1 ]; then
        echo -n $OUTPUT;
    else
        if [[ -n "$SSH_TTY" ]]; then
            echo -n $OUTPUT > $SSH_TTY;
        else
            echo 'Standard output is not tty and there is no $SSH_TTY' 1>&2;
        fi;
    fi
}

ios_sequence_spaced () {
    if [[ -n "$TMUX" ]]; then
        OUTPUT=$(ios_printf '\033Ptmux;\033\033]'
echo -n "$1"
ios_printf '\a\033\\');
    else
        OUTPUT=$(ios_printf '\033]'
echo -n "$1"
ios_printf '\a');
    fi;
    if [ -t 1 ]; then
        echo -n $OUTPUT;
    else
        if [[ -n "$SSH_TTY" ]]; then
            echo -n $OUTPUT > $SSH_TTY;
        else
            echo 'Standard output is not tty and there is no $SSH_TTY' 1>&2;
        fi;
    fi
}