Q:

Enumerate files *.pdf exclude *_book.pdf

How can enumerate all file file in dir, exclude by pattern.
For example: all *.pdf exclude *_book.pdf. I try so:
for $PDF in $(ls *.pdf | grep -v *_book.pdf);
do
   echo "File $PDF"
done

It is a good way? Are there any other ways? Used if statement or other.

A:

Don't use ls in scripts.
Also, the variable that you declare in the for loop should not have a dollar sign. The dollar sign interpolates the value of a variable; so $PDF reads as "the current value of the variable whose name is PDF".
for PDF in *.pdf
do
    case $PDF in
     *_book.pdf) continue;;
    esac
    echo "File $PDF"
done

The case syntax scares some beginners, but I vastly prefer it over if for things like this.  But if you prefer, you can use
    if [[ $PDF =~ _book\.pdf$ ]]; then
        continue
    fi

or the shorthand
    [[ $PDF =~ _book\.pdf$ ]] && continue

case has the additional benefit that it is portable to POSIX sh and even the good olde original Bourne sh.
Notice that the pattern in case is a glob, while [[ $variable =~ regex ]] uses a regular expression (so there should be no * before _book).

