Yes, ive been working on it for a combined total of maybe 10 hours, but yeah! I’ve been having a lot of fun, as well as learning ever more about *nixes and how shells actually do io redirection.
I always love to try new stuff, I’ll keep an eye on this project.
Also, I know that we all love the name zig, but we really should only use it for naming libraries. Other apps also don’t use the name of the programming language in the app name itself.
For a shell you have to go with something traditionally, like selfish
Really cool. Just cloned your project and gave it a try. Runs very well.
I also like it that your shell displays the exit code (I assume) of the last command by default. However, the error code only gets updated if one of your builtins is executed:
0 $ cd /cool # try cd to non-existen dir
254 $ pwd # error code 254, try execute external command
/home/lukeflo
254 $ echo code # still error code of builtin cd, not 0 for successful external. run builtin echo
code
0 $ # back to correct exit code for builtin echo
Of course, you might be aware of this. It just was the first thing popping to my eye because I liked the standard prompt containing the exit code so much.
I really like this idea. Are you just trying to reimplement bash or do something different? – I personally don’t care for unix style shell scripting and would love a native shell that used more c style.
Also have you checked out this tutorial on code crafters.
This is very cool! I’ve got a teeny project started like this myself, called zish, but I hardly got anywhere with it. Good luck on replacing Bash, make something good enough even I might use it!
Right now the idea is to re-implement my usual bash workflow, as I use bash already, but once I get further into it (you’ll notice there is no scripting capability currently) who knows? I think I want to follow the zen of zig, and bring it to a scripting language, but so far I don’t really know what that looks like yet.
I had not seen that, I’ll check it out, but a cursory glance makes it look like a pretty hand-holding tutorial, which I want to avoid (I don’t like overbearing tutorials).
Hey, I’m also working on a minimal shell in zig. I must say it’s a nice feeling going through a similar project to see how differently things were implemented. Check out mine: shellu.
I have command completion implemented, thanks to GNU readline
Completely understandable. I stumbled across linenoize trying to find a zig replacement, but yeah, readline is the OG in that space.
You have put a lot more work into the fundamentals for sure, I really just jumped straight into IO redirection honestly. I like what you’ve got going on, and I might steal ideas. Looks really nice!
Appreciate it! Yeah, actually I’ve been meaning to replace readline with linenoize, mainly to avoid any system dependency. That’s also why I’m not going to use Anyline, which I suggest you check out. It’s supposed to be a drop in replacement for readline, if I’m not mistaken, purely written in zig.
Thanks for posting this. Your project inspired me to add gitlab support to my hew cli tool. I can build/install your project from source on linux/macos via:
sh -c "$(curl -fSL https://gethew.github.io/sh)"
hew install gitlab:zigish/zigish