Skip to content

Conversation

@happy-game
Copy link
Collaborator

问题描述

使用sed命令报错 macOS/BSD 版本的 sed 在处理地址范围和替换命令时,其语法与 GNU sed (Linux 常用版本) 不兼容

[chsrc 运行] sed -i '' '/^[[index]]$/,/^default = true$/{s|^url = ".*"$|url = "[https://mirrors.cloud.tencent.com/pypi/simple"|}](https://mirrors.cloud.tencent.com/pypi/simple%22%7C%7D)' ~/.config/uv/uv.toml
sed: 1: "/^[[index]]$/,/^def ...": bad flag in substitute command: '}'
[chsrc 运行] x 命令执行失败,退出状态: 256
chsrc: 关键错误,强制结束

#323


方案与实现

在 s 命令后添加分号 ; 明确标记命令结束, 谢谢@knightArtorias777 定位问题并给出解决方案.

- @sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|}' @f@
+ @sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|;}' @f@

@github-actions
Copy link

Hi @happy-game,

❤️ 感谢你的贡献!你的 PR 当前基于 main 分支,请修改使用 dev 分支

@happy-game happy-game changed the base branch from main to dev December 17, 2025 06:55
@ccmywish ccmywish added this to the v0.2.4 milestone Dec 18, 2025
@ccmywish ccmywish added the pl_target pl target label Dec 18, 2025
@ccmywish ccmywish merged commit f5c78c5 into RubyMetric:dev Dec 18, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pl_target pl target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants