#!/bin/bash

# ideone boilerplate - we can't write files in the home directory;
# so create a temporary directory for our files instead
t=$(mktemp -d -t ideone.XXXXXXXXXXXX) || exit
trap 'rm -rf "$t"' ERR EXIT
cd "$t"

touch file{1..200}.pdf

for this in file{[1-9],[1-9][0-9],[1-9][0-9][0-9]}.pdf; do
    case $this in
     *[13579].pdf)
        prev=$this; continue;;
     *) base=${this%.pdf}
        cat "$prev" "$this" >combined$((${base#file} / 2)).pdf;;
    esac
done

ls -l
