用 units 进行单位换算

在长度、质量、温度等众多单位之间转换。

macOS终端脚本低风险
运行 units "10 miles" "km",输出换算结果。

01命令

命令
$ units "10 miles" "km"

02作用说明

units 内置庞大的物理单位数据库,支持 60 mph、m/s^2 等复合表达式。不带参数运行进入交互模式,也可一次传入两个量直接换算。

03风险

风险低风险
系统兼容性macOS (built-in)
!注意: 单位名称区分大小写,含糊的缩写可能被误读;参数加引号避免被 shell 拆分。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • GNU Units
    GNU · technical · 2026-09-20
    依据: GNU Units converts between thousands of units; the macOS units is a compatible implementation.

最后验证: 2026-09-20 · 分类: 开发者

06相关方案