TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Brush (Bo(u)rn(e) RUsty SHell) a POSIX and Bash-Compatible Shell in Rust

163 点作者 voxadam6 天前

14 条评论

chubot6 天前
Hm I wasn&#x27;t aware of this project, it seems to have started in 2022<p>Other than OSH, it seems to be the only shell that aims for POSIX&#x2F;bash compatibility, out of dozens of alternative shells: <a href="https:&#x2F;&#x2F;github.com&#x2F;oils-for-unix&#x2F;oils&#x2F;wiki&#x2F;Alternative-Shells">https:&#x2F;&#x2F;github.com&#x2F;oils-for-unix&#x2F;oils&#x2F;wiki&#x2F;Alternative-Shell...</a><p>As far as I know, OSH is the most POSIX- and bash-compatible shell:<p><i>Nine Reasons to Use OSH</i> - <a href="https:&#x2F;&#x2F;oils.pub&#x2F;osh.html" rel="nofollow">https:&#x2F;&#x2F;oils.pub&#x2F;osh.html</a><p>If I have time, I will run this through our spec tests: <a href="https:&#x2F;&#x2F;oils.pub&#x2F;release&#x2F;0.29.0&#x2F;test&#x2F;spec.wwz&#x2F;osh-py&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;oils.pub&#x2F;release&#x2F;0.29.0&#x2F;test&#x2F;spec.wwz&#x2F;osh-py&#x2F;index.h...</a><p>---<p>About this part: <i>There are a number of other POSIX-ish shells implemented in a non-C&#x2F;C++ implementation language</i><p>OSH is implemented in an unusual style -- we wrote an &quot;executable spec&quot; in typed Python, and then the spec is translated to C++.<p>That speeds it up anywhere from 2x-50x, so it&#x27;s faster than bash on many workloads<p>e.g. a &quot;fibonacci&quot; is faster than bash, as a test of the interpreter. And it makes 5% fewer syscalls than bash or dash on Python&#x27;s configure (although somehow this doesn&#x27;t translate into wall time, which I want to figure out)<p>It&#x27;s also memory safe, e.g. if there is no free() in your code, then there is no double-free, etc.<p>---<p>As mentioned on the OSH landing page, YSH is also part of the Oils project, and you can upgrade with<p><pre><code> shopt --set ysh:upgrade </code></pre> If you want JSON and so forth, e.g.<p><pre><code> ysh$ json read &lt; x.json ysh$ = _reply (Dict) {shell: &quot;ysh&quot;, fun: true} </code></pre> YSH aims to be the &quot;ultimate glue language&quot; - <a href="https:&#x2F;&#x2F;oils.pub&#x2F;ysh.html" rel="nofollow">https:&#x2F;&#x2F;oils.pub&#x2F;ysh.html</a>
评论 #43910212 未加载
评论 #43914229 未加载
d4mi3n6 天前
Since everyone is sharing shells written in Rust, I&#x27;ve become quite fond of Nushell: <a href="https:&#x2F;&#x2F;www.nushell.sh&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.nushell.sh&#x2F;</a><p>I&#x27;d love to see more shell exploring things beyond POSIX. Text based stdin&#x2F;stdout will always have its place, but having ways to express, serialize, and pass along data in more structured ways is quite nice.
评论 #43910081 未加载
评论 #43920993 未加载
评论 #43910019 未加载
Pet_Ant6 天前
Another *-nix shell written in Rust[1] (but neither POSIX nor Bash compatible[2]): Fish<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;fish-shell&#x2F;fish-shell&#x2F;releases&#x2F;tag&#x2F;4.0.0">https:&#x2F;&#x2F;github.com&#x2F;fish-shell&#x2F;fish-shell&#x2F;releases&#x2F;tag&#x2F;4.0.0</a><p>[2] <a href="https:&#x2F;&#x2F;fishshell.com&#x2F;docs&#x2F;current&#x2F;design.html" rel="nofollow">https:&#x2F;&#x2F;fishshell.com&#x2F;docs&#x2F;current&#x2F;design.html</a>
评论 #43909248 未加载
评论 #43909222 未加载
Ericson23146 天前
This is interesting to me given <a href="https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nix&#x2F;issues&#x2F;10823">https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nix&#x2F;issues&#x2F;10823</a><p>We have a decent amount of code in bash that I&#x27;d like to get working on Windows too, once Nix on Windows is ready. I&#x27;m happy to rewrite it to a better language, but if I can get a non-CygWin&#x2F;MSYS2 bash-compatible shell, that&#x27;s a very nice thing to try out.
评论 #43908862 未加载
评论 #43910006 未加载
评论 #43909170 未加载
ris6 天前
This is cool, but still<p>(...HN formatting fail, imagine shell output showing the nixpkgs bash binary is 1.1M, the brush binary is 6.9M...)<p>with no prospect of further amortizing that size through shared libraries. Without shared libraries the only chance I see for rust being used to replace base system tools is with multi-call binaries a la busybox.
评论 #43910652 未加载
Muromec6 天前
That&#x27;s nice. Somehow it doesn&#x27;t play nice with fzf scripts (&#x2F;usr&#x2F;share&#x2F;fzf&#x2F;key-bindings.bash and &#x2F;usr&#x2F;share&#x2F;fzf&#x2F;completion.bash)
hdjrudni6 天前
Other than being written in Rust, what are it&#x27;s selling points? I&#x27;m not seeing anything in the README.<p>Is it faster, but otherwise identical to bash? And if yes, are there any sorts of benchmarks?
评论 #43912280 未加载
koakuma-chan6 天前
&gt; Its Linux build is fully supported running on Windows via WSL<p>So I would run WSL in powershell, and Brush in WSL?
wiz21c6 天前
Once again, a rust rewrite ends up with a weaker licence (bash is GPL, brush is MIT).<p>I love rust, but please, keep free software free. If only because you most likely benefited from past free software.
shiomiru6 天前
Another POSIX shell in Rust I remember: <a href="https:&#x2F;&#x2F;github.com&#x2F;nuta&#x2F;nsh">https:&#x2F;&#x2F;github.com&#x2F;nuta&#x2F;nsh</a><p>But it no longer seems to be in active development.
cryptonector6 天前
Joy!
mystified50166 天前
BRASH was right there
ohroy6 天前
that&#x27;s cool but I can&#x27;t find a reason to use it.
评论 #43914327 未加载
nbenitezl6 天前
My favourite shell written in Rust is wezterm, totally recommend it.<p><a href="https:&#x2F;&#x2F;wezterm.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;wezterm.org&#x2F;</a>
评论 #43913637 未加载