#!/bin/bash ext=$1 out=$2 if [ -z "$ext" ] ; then echo "img2pdf (png,jpg,tiff,...) (output)" exit fi if [ -z "$out" ] ; then out=$(basename `pwd`).pdf fi for img in $( echo `ls -v | egrep \."$ext"$` ) ; do echo Traitement de "$img" img2pdf --output "${img//$ext/pdf}" "$img" done; if [ -e "$out" ] ; then echo "Gestion backup" set -x rm "$out" set +x fi gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="$out" `ls -v | egrep \.pdf$` for img in *."$ext" ; do rm "${img//$ext/pdf}" done;