I'm trying to create a bash script that converts a bunch of pdfs into text in order to extract some information but the shell gives me this error:
./AutoBib.sh: line 8: syntax error near unexpected token `pdftotext'
./AutoBib.sh: line 8: ` pdftotext $1 temp.txt'
Here there is an example of my function:
function doi{
pdftotext $1 temp.txt
cat temp.txt | grep doi: | cut -d: -f 2 | head -n 1 >> dois.txt
rm -rf temp.txt
}
doi $PDF
Where the variable PDF
is taken in input. Before adding the function it worked, I used to write in my script:
pdftotext $PDF tempo.txt