⏺ ## Bug Description
install-safe-rm.sh 发布文件使用 CRLF (\r\n) 换行符,导致在 macOS/Linux 上执行失败:
/tmp/install-safe-rm.sh: line 10: : command not found
/tmp/install-safe-rm.sh: line 11: set: - invalid option
/tmp/install-safe-rm.sh: line 24: syntax error near unexpected token `{'
Steps to Reproduce
curl -sSL https://github.com/blueraincoatli/safe-rm-toolkit/releases/latest/download/install-safe-rm.sh -o install-safe-rm.sh
bash install-safe-rm.sh
Root Cause
发布文件使用 \r\n (CRLF) 而非 \n (LF),通过 xxd 确认:
00000000: 2321 2f62 696e 2f62 6173 680d 0a23 2053 #!/bin/bash..# S
Workaround
tr -d '\r' < install-safe-rm.sh > install-safe-rm-fixed.sh
bash install-safe-rm-fixed.sh
Suggested Fix
1. 添加 .gitattributes 文件强制 shell 脚本使用 LF:
*.sh text eol=lf
2. 或在发布前转换:sed -i 's/\r$//' install-safe-rm.sh
Additional Issue
macOS 的 trash 脚本中 osascript 语法有误,quoted form of 无法在 -e 单行模式中使用,应改为:
osascript -e "tell application \"Finder\" to delete (POSIX file \"$abs_path\")"
Environment
- macOS Darwin 25.3.0
- Shell: zsh
⏺ ## Bug Description
install-safe-rm.sh发布文件使用 CRLF (\r\n) 换行符,导致在 macOS/Linux 上执行失败:/tmp/install-safe-rm.sh: line 10: : command not found
/tmp/install-safe-rm.sh: line 11: set: - invalid option
/tmp/install-safe-rm.sh: line 24: syntax error near unexpected token `{'
Steps to Reproduce
curl -sSL https://github.com/blueraincoatli/safe-rm-toolkit/releases/latest/download/install-safe-rm.sh -o install-safe-rm.shbash install-safe-rm.shRoot Cause
发布文件使用
\r\n(CRLF) 而非\n(LF),通过xxd确认:00000000: 2321 2f62 696e 2f62 6173 680d 0a23 2053 #!/bin/bash..# S
Workaround