rustshellscript
rustshellscript on Hacker News
Posted by
rustshellscript on Sunday June 28, 2026 @03:26AM
from the fractalbits.com dept.
The only good part of sh/bash script is to run commands with piping/redirection support IMO,other than that I saw posts like this to explain sh/bash script’s puzzles/pitfalls all the time.
Maybe it is time to consider using rust instead: https://github.com/rust-shell-script/rust_cmd_lib ?
Thanks Steve. I have studied the "200 lines" book a few days ago, but was still confused. Only after seeing your talks, everything becomes so much clearer. These talks should really be part of the "async book" :)
Posted by
rustshellscript on Saturday November 28, 2020 @11:06PM
from the cfsamson.github.io dept.
since run_cmd! and run_fun! are returning result type, you can always do let _ = run_cmd!(ls nofile); to ignore single command error.
The “xxx || true” is for ignoring error within a group of commands, which is also very common in sh “set -e” mode. Without it, the group of commands need to be divided into at least 3 parts to still capture all possible command errors. I probably need to document this part with more details.
It can be supported with internal APIs, even without macros:
Cmds::from_cmd(Cmd(...).current_dir(..))
.pipe(Cmd(...).current_dir(...))
.run_cmd(...)
As you can see, it is very verbose and that's why I choose to hide the lower APIs at this moment.
Thanks, yes since I just finished the core functionality of this project and I am not surprised if it is still missing some critical features when converting bash script. Pls file bugs if you find anything :)
You can consider it was enabled by default, and any failed command would return error unless you mask it with “xx || true”.
Author here, thanks for your feedback. This library is calling std::process::command underneath without any shell dependency, which I believe is the same as plumbum’s run* APIs and I should make it clearer in the docs.
This plumbum has its own “cp”, “cat” .., which is similar to shelljs and it looks like a lot of people like this idea which can also be supported by this library in the future.
Posted by
rustshellscript on Sunday August 23, 2020 @01:04AM
from the show-hn dept.