Get bibtex entries from metadata of PDF files
Always double-quote variables if they might contain spaces

These commands will fail if the variables contain spaces:


cd $FOLDER

# ...

echo &gt;&gt; $BIBTEX_FILE



Even if you never intend to use your script with paths containing spaces,
it's good to make it a habit to double-quote variables that might contain spaces:

cd "$FOLDER"

# ...

echo &gt;&gt; "$BIBTEX_FILE"


Error checking

What will happen if this command fails?


cd $FOLDER



If this fails, the program will happily continue,
download a likely invalid url with curl,
and create a bogus $BIBTEX_FILE,
essentially putting garbage in the current directory.

Look for possible points of failure where the program should abort.
If something goes wrong with this cd command you definitely don't want execution to continue.
Here's a simple way to abort:

cd "$FOLDER" || exit 1


Here's a more user-friendly way:

if ! cd "$FOLDER"; then
    echo "error: could not cd into $FOLDER"
    exit 1
fi


Use the modern $(...) instead of the obsolete `...`

For example:

TITLE=$(pdfinfo "$f" | grep Title | cut -c17-)


Notice that I double-quoted $f, as it should be.

Bogus pipeline

This is strange:


pdftotext $f /tmp/pdf | cat /tmp/pdf | ...



In a pipeline, usually the output of one command is passed as input to the next through stdout and stdin file handles. That's not what happens here, data is passed through a file. This is unusual and confusing.
Also confusing is to name a text file /tmp/pdf.

You don't need a temporary file here,
pdftotext can produce output on stdout,
and then you don't need cat either:

pdftotext $f - | ...


Removing double-quotes from the output of jq

Instead of this:


curl -s $URL | jq '.message.items[].DOI' | sed 's/"//g'



You can remove the double-quotes by using the --raw-output flag:

curl -s "$URL" | jq -r '.message.items[].DOI'


-r is a shortcut for --raw-output.
Notice also, once again, that I added the necessary double-quotes around $URL.

Redirecting multiple statements

This kind of repetition quickly becomes annoying:


curl -s $URL &gt;&gt; $BIBTEX_FILE
echo &gt;&gt; $BIBTEX_FILE
echo &gt;&gt; $BIBTEX_FILE



You can dispense with that using grouping:

{
    curl -s "$URL"
    echo
    echo
} &gt;&gt; "$BIBTEX_FILE"