‹ 首页

writing-bash-scripts

@lexler · 收录于 昨天 · 上游提交 1 周前

Bash script style guide. Always use when writing bash scripts, shell scripts, or CLI bash tools.

适合你,如果经常编写 Bash 脚本并希望保持风格一致。

/ 通过 npx 安装 校验哈希
npx oh-my-skill add lexler/skill-factory/writing-bash-scripts
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- lexler/skill-factory/writing-bash-scripts
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify lexler/skill-factory/writing-bash-scripts
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
223GitHub stars
~124最小装载
~124含声明引用
~845文本包总量
索引托管

怎么用

商店整理自技能原文 · 版本 2eae60e · 表述以原文为准
它做什么

Claude 在写 Bash 脚本时,会使用 #!/usr/bin/env bash 作为 shebang,设置 set -euo pipefail,保持脚本简洁,仅做最小输入验证,不检查已安装命令,并确保脚本可执行。

什么时候触发

当用户要求编写 Bash 脚本、Shell 脚本或 CLI Bash 工具时触发。

装好后可以这样说
这会使脚本符合风格指南。
脚本将简洁且安全。
技能原文 SKILL.md作者撰写 · Apache-2.0 · 2eae60e

Bash Script Style Guide

  • Use #!/usr/bin/env bash as shebang
  • Always use set -euo pipefail for safety
  • Keep scripts minimal: no unnecessary comments or echoes
  • Minimal input validation; print usage to stderr and exit if inputs are missing/invalid
  • Don't check for installed commands if failure is obvious on use
  • Make script executable: chmod +x <script>
  • Prefer concise, direct logic over verbosity
按 Apache-2.0 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。