bash - 为什么函数定义中的花括号前需要空格?
问题描述
我正在尝试创建一个 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
解决方案
推荐阅读
- javascript - 保存到 MongoDb 时的节点 UnhandledPromiseRejectionWarning
- python-3.x - 如何逐个文件夹实现批处理
- c# - 没有足够的配额可用于在 UpdateWindowSettings 上处理此命令
- html - 将 div 排成一行的问题
- docker - 连接到 docker 上运行的 grpc 服务器时出现 DNS 解析失败错误
- python - Python - Ply Parser:如何在任何我想要的地方停止解析?
- c# - httpget请求webapi core 3.0的流利验证
- python - 在终端模式下执行时,它工作正常,但如果我从文件中执行相同的代码,例如 xyz.py
- python - 将特定时期的概率数据框转换为 n 个时期内至少一次的概率?
- android - MYSQL 随机选择候选行但只选择一次