Lobsters· brut.sh by sstephenson·· 2026-10-07AI 评分28
Brut:面向 Unix 工具的 Brutal Router 源码解析
Brut, the Brutal Router for Unix Tools
AI 导读
Brut 是 Brutal Unix 项目中的单文件 POSIX shell 脚本,作为 Unix 命令行程序的前端可执行文件,按文件名和首个参数把调用路由到对应命令,风格类似 Git CLI。它约 120 行 shell 代码,仅依赖 POSIX.1-2024 规定的基础工具,提供命令、共享脚本、错误处理、路由钩子、可扩展性和命名空间分组。
来源:Lobsters · brut.sh
社媒成稿工作台 · 一键复制
飞书同步推送 · 含数据/日期/出处/启发Brut:面向 Unix 工具的 Brutal Router 源码解析 📊 核心数据与事实(2026-10-07): Brut 是 Brutal Unix 项目中的单文件 POSIX shell 脚本,作为 Unix 命令行程序的前端可执行文件,按文件名和首个参数把调用路由到对应命令,风格类似 Git CLI。它约 120 行 shell 代码,仅依赖 POSIX.1-2024 规定的基础工具,提供命令、共享脚本、错误处理、路由钩子、可扩展性和命名空间分组。 • 原文实测切片:a = ARGV[1] } $2 " " $1 " } 3.4 The searchpath Helper We have now reached the engine of Brut, the searchpath helper, which wraps find to search the directories in $PATH for executables matching specified criteria. • 原文实测切片:searchpath -type l -name " ${1 :- $NAME} - · " \ -exec sh -c '[ "$0" = "$(realpath "$1")" ] 2>/dev/null' " $SELF " {} \; • 原文实测切片:INVOCATION COMMAND ARGUMENT LIST myprog build a "$1" '"${2}"' myprog ‑v build a "$2" '"${1}" "${3}"' myprog build ‑v a "$1" '"${2}" "${3}"' myprog build a b c "$1" '"${2}" "${3}" "${4}"' # Scan the argument list to find the command name… 💡 对独立开发者的启发: 1/ 供给端造工具的门槛已被 AI 和开源抹平,独立开发者真正的护城河是「找准垂直业务场景 + 做好分发」。 2/ 面对新模型或开源组件先看三件事:许可证是否商用安全、API/推理边际成本降了多少、能不能直接嵌进现有变现工作流。 3/ 别去卷通用开发者轮子,把底层新能力包装成面向具体行业人群(电商、创作者、中小商家)傻瓜式交付结果的产品。 📅 日期:2026-10-07(北京时间) 📰 信息源出处:Lobsters · brut.sh by sstephenson(brut.sh) 🔗 原文:https://brut.sh/ 📡 归档:https://billionare.me/items/p6sk3e4ymz4luhkodoxsm5xie