#!/bin/bash convert=$(gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$1" "$2" "$3" 2>&1) if echo "$convert" | grep -q "Error: " ; then echo "Failed to cat files" echo $convert else echo "Wrote contents of $2 and $3 to $1" rm -v "$2" "$3" fi