【发布时间】:2018-11-14 22:55:09
【问题描述】:
我正在尝试创建一个 bash 脚本,将一堆 pdf 转换为文本以提取一些信息,但是 shell 给了我这个错误:
./AutoBib.sh: line 8: syntax error near unexpected token `pdftotext'
./AutoBib.sh: line 8: ` pdftotext $1 temp.txt'
这里有一个我的函数的例子:
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
变量PDF 被输入。在添加它起作用的功能之前,我曾经在我的脚本中编写:
pdftotext $PDF tempo.txt
【问题讨论】:
标签: bash function shell syntax