You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在WSL中运行pandoc lua-filters仓库runtests.sh脚本报错求助

解决WSL Ubuntu中运行pandoc lua-filters的runtests.sh脚本报错问题

你遇到的错误由以下两种常见原因导致,对应解决方法如下:

1. 使用了不兼容的shell解释器

该脚本基于bash编写,但Ubuntu系统中sh默认指向的是dash(轻量级shell,与bash语法不完全兼容),直接用sh runtests.sh调用会触发语法不兼容错误。

解决方法:
用bash直接运行脚本:

bash runtests.sh

2. 脚本换行符为Windows格式(CRLF)

克隆仓库时,若git自动将换行符转换成Windows的CRLF格式,bash解析时会把换行符识别为非法字符,从而出现"not found"和语法错误。

解决方法:

  • 转换脚本换行符为Unix格式(LF):
# 先安装dos2unix(若未安装)
sudo apt update && sudo apt install dos2unix
# 转换换行符
dos2unix runtests.sh
  • 或重新配置git避免自动转换换行符后,重新克隆仓库:
git config --global core.autocrlf false
git clone https://github.com/pandoc/lua-filters.git

内容的提问来源于stack exchange,提问作者user32882

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 15:42:37