Show HN: Using Rust to write shell-script like tasks
I&#x27;m going to shamelessly plug my own library here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;oconnor663&#x2F;duct.rs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;oconnor663&#x2F;duct.rs</a><p>I wanted to solve the same problem, originally in Python (<a href="https:&#x2F;&#x2F;github.com&#x2F;oconnor663&#x2F;duct.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;oconnor663&#x2F;duct.py</a>). It&#x27;s surprisingly annoying to do pipelines and redirections, compared to how easy they are to do in the shell. Lots of libraries try to address this, but most of them seem do it by emulating shell syntax within the host language, using operator overloading or other magic like that. I think that&#x27;s a limiting choice. (For example, can you use `cd` to change the working dir for the left half of a pipeline but not the right half? In Bash you would use a &quot;subshell&quot; for this.) Instead, I think it&#x27;s sufficient to build an API out of regular objects with regular methods. The result doesn&#x27;t look like shell code, but it&#x27;s easier to reason about, and more consistent across different languages.