5 ms·
Cicada: A Bash-like Unix shell written in Rust
- johnklos 7y agoThose who do not understand Unix are condemned to reinvent it, poorly. -- Henry Spencer Yay! Non-portable Unix tools! Just what everyone wants.
- nerdponx 7y agoWhat's not portable about it? Rust is reasonably portable, no? Also they are claiming to be generally (but not strictly) POSIX-compatible.
- pjmlp 7y agoExcept, UNIX wasn't the first OS with a shell. There was at least 10 years of shell history before UNIX came to be.
- yjftsjthsd-h 7y agoThis isn't reinventing Unix, this is a (cut down part of) Unix. (Unix the family, not the original Bell Labs OS, of course). And "non-portable" because it's only portable to Unix? That's... Approximately everything. Linux family and Darwin naively, NT via WSL/cygwin/etc., BSDs obviously, Android sorta-natively or via Termux, Chrome OS via Termux, crouton, or crostani(sp?). What is Unix not portable to?
- unwrap 7y agoIt's probably the usual complaint of Rust not being able to run on an obscure 1965-era calculator.
- fluffything 7y agoI can't run C on a 8-bit calculator either. At least not using GCC or Clang or any other mainstream compiler. Sure, I could use some toy compiler for that, but then 99% of the libraries I'd like to use won't work there anyways, due to a variety of issues.
- yjftsjthsd-h 7y agoI was about to object, but actually it looks like you're right; tigcc appears to only target the TI-89 et al. which run on the 16-bit Motorola 68000 series. A quick search doesn't give me any C compiler for the TI-84 after all. Your actual point, of course, is valid regardless:) EDIT: Oops, actually https://en.wikipedia.org/wiki/Small_Device_C_Compiler https://en.wikipedia.org/wiki/Small_Device_C_Compiler ... but then you're right about getting pretty obscure.
- oblio 7y ago> Those who do not understand Unix are condemned to reinvent it, poorly. -- Henry Spencer I absolutely abhor this quote, I think it's taken out of context. First of all, it denotes hubris, which I hate. Secondly, it's totally anti-scientific, it assumes that Unix is some paragon of OS design, the zenith of Computer Science. I like Unix as much as the next IT guy, but let's cut it out with the cliché quotes. There's plenty of things Unix doesn't do that well (everything is a file, until it isn't; filenames are basically binary blobs, etc.: https://dwheeler.com/essays/fixing-unix-linux-filenames.html https://dwheeler.com/essays/fixing-unix-linux-filenames.html). Plus your comment is just silly, whoever implemented this obviously knew about Unix shells... It takes knowledge of Unix shells to implement another Unix-y shell.
- keyle 7y agoI was looking for something actually bringing a net positive... but the FAQ has answered my question > Why another shell? > Because we can. :) It doesn't do anything exciting that I can tell. This post would be more useful if it were titled as a 'learn how to write a shell in Rust'.
- dmix 7y agoInteresting. Having the core terminal/language down is a good start. An important part of any terminal will be it's support for plugins/extensions or otherwise natively replacing them the way Fish tries to do. I've recently started using https://elv.sh/ https://elv.sh/ as my primary terminal after testing it out on/off for 2yrs and slowly porting old ZSH aliases/scripts into the Elvish language (very similar to Go which it runs on), coming from a decade on ZSH. There's a lot of opportunity in this space. ZSH with the full suite of packages with autosuggestions and various other plugins (which I've grown fully dependent on) can get very slow on initial terminal loads, even with tracing and optimization. Smaller tools like ripgrep and exa both written in rust help speed up common terminal commands: https://github.com/ogham/exa https://github.com/ogham/exa
- genieyclo 7y agocan you share these zsh to elvish ports?
- rufugee 7y agoYes, please...and also your experience with elvish in general?
- dmix 7y agoYes, I intend to publish them soon when I’m more comfortable with it. I’ve only switched over this month and it’s changing often. I released a vim plugin in the meantime: https://github.com/dmix/elvish.vim https://github.com/dmix/elvish.vim And zzamboni on github has some good starting dot-files which I forked initially. https://github.com/zzamboni/dot-elvish https://github.com/zzamboni/dot-elvish Otherwise I’m interested in creating an oh-my-elvish type library in the future.
- armitron 7y agoThe right term for what you refer to as terminal(s) is shell. A terminal (or a terminal emulator) is not a shell and, moreover, a shell does not necessarily require a terminal.
- dang 7y agoDiscussed in 2017: https://news.ycombinator.com/item?id=14675431 https://news.ycombinator.com/item?id=14675431
- mitnk 7y agoYeah, I submited once on HN about this project two years ago. Since then quite a few new features have been added and some improvements are made. So it's time to expand the user base a bit :) Now cicada shell is still have some issues, but overall it's quite usable. I hope it could be useful for people who are seeking simplicity and speed in daily use of the shell.
- madmax96 7y agocicada> echo -e '#!/bin/sh\necho works' > /bin/1 cicada> chmod +x /bin/1 cicada> 1 1 bash> 1 works cicada> touch a b; echo "$(echo "$(echo "$(ls)")")" $(echo $(echo a b bash> echo "$(echo "$(echo "$(ls)")")" a b
- mitnk 7y ago# you have to use full path to make it work: cicada> /bin/1 A bare `1` is a math arithmetic, as described in README, which with a higher precedence.
- madmax96 7y agoPerhaps you should consider removing the statement "Cicada will only be a "subset" of bash" from the project FAQ.
- mitnk 7y agoFor `touch a b; echo "$(echo "$(echo "$(ls)")")"`, I'll think about it. It looks like a bad command to me (nested $ and nested `"` do not smell good). Probably I would mark this a wont-fix. But if I found I does make sense (useful in some meaningful places) - I'll consider to update cicada to align with Bash. Thanks for reporting.
- aepiepaey 7y agoNested $() is fine, and not uncommon (though 3 levels like here is rarely used). All the nested "" present here are required, as removing any of them would cause a change in behavior (caused by word splitting).
- latexr 7y ago> Math arithmetic directly in the shell![1] Killer feature right there. [1]: https://github.com/mitnk/cicada#math-arithmetic-directly-in-the-shell https://github.com/mitnk/cicada#math-arithmetic-directly-in-...