fix: 修复 Linux 下启动脚本问题 (#28) #31
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: 修改Linux启动脚本以修复Linux下的启动问题(#28 )
\r\n导致的启动报错#!/usr/bin/env sh)注意:
修改1未必有效,因为Windows环境默认使用
\r\n换行而Linux下使用\n,使用Windows编辑此文件或使用Windows的Git客户端提交代码还是可能出现自动替换换行符。建议直接在actions的工作流添加针对Linux相关脚本的替换(将
\r\n替换为\n),可使用这条命令完成sed -i 's/\r$//' ./setup.sh && sed -i 's/\r$//' ./start.shGPT对修改2的解释:
原脚本使用的 Shebang 为:
#!/usr/bin/env /usr/bin/sh这种写法实际上会让
env去查找名为/usr/bin/sh的可执行文件,而不是预期的sh。在大多数系统中,
/usr/bin/sh只存在于文件路径中,不会作为命令出现在PATH下,因此会导致脚本直接报错:隐患包括:
/usr/bin/sh,某些没有);修复方式:
将 Shebang 修改为标准写法:
#!/usr/bin/env sh这样
env会根据环境变量PATH自动查找sh,保证脚本在大多数类 Unix 系统上都能正常运行。