Hacker Newsnew | past | comments | ask | show | jobs | submit | doe88's commentslogin

Is there a (real) shell whose code is relatively short and self contained and would be valuable to read? This was always something I wanted to do but never quite spent time to look for a good one to explore.

It depends on what you are looking for. My recommendation for learning "how is X done in a shell" is the OpenBSD ksh: https://github.com/ibara/oksh

It's what they use for /bin/sh, it has everything that a complete shell needs (including a mechanism for providing command completions) and has code that is much easier to read than bash or zsh.

Something that I also would recommend is the design document for the plan9 rc shell; it is a worthwhile read for anybody interested in shells: https://doc.cat-v.org/plan_9/4th_edition/papers/rc

An implementation is also available if one wants to look at how it could be done: https://github.com/rakitzis/rc


Although not the same... Destroy All Software has videos on building your own shell using Ruby. I watched it to learn and it was a lot of fun to watch him basically building a shell, I'm not really a Ruby guy, but it was easy to grasp. It's not free, you would need a subscription, but its worth the watch otherwise.

https://www.destroyallsoftware.com/screencasts/catalog/shell...


I don't know how real you want -- those criteria are probably self contradictory :-)

Marc Rochkind's book Avanced UNIX Programming implemented a basic shell, through iterations. You can see the first at e.g. here https://github.com/gmarler/AUPv2/blob/master/c5/sh0.c

It might be a bit old too. The book is very good but again, quite old. There seem to be free copies of it on the net.

BTW, does anyone know if Marc Rochkind is alive? His site basepath.com seems to be for sale :-(


I think there's a good one if you search around for "xv6 sh.c". Hard to tell immediately from a google search just now since there are many implementations (people do it in school) and github's currently blocking requests from my phone.

Also helpful may be running strace on your shell, then reviewing the output line by line to make sure you understand each. This is a VERY instructive exercise to do in general.



St is a terminal, not a shell.

I don't understand all these sites with moving parts even with muted soon, like if everything was a collection of GIFs. NYT followed this path and started to insert muted clips preheminently on their page one, very very annoying.

It is like a guy seeing headlines "wapo is losing" money and feeling ashamed in its "genius entrepreneur's ego / could never be wrong" and taking revenge on whoever he can take revenge and inflict pain just for the sake of it.

It is vibe justice for people, when you run Agents and don't check by yourself the code produced or the people jailed. Despite the appearancs your program don't really work and soon or later you find it to your expense.

Sometimes life is also to let it express partial, unfinished ideas, opinions and maybe later let our brain refine them on its own tempo. It never has been uncommon.

https://en.wikipedia.org/wiki/L%27esprit_de_l%27escalier


It will go as long as certificates chains are valid.


I don't understand what is the purpose of these bots? Nihilism? Vandalism? At first I doubted when people were saying that such and such comments was AI generated, I didn't understand the goal, the motives so I thought it couldn't be ; but lately I understood how dead wrong I was, we are submerged, I came to realize that we are eaten by a sea of these useless comments.


You can control the major narrative on social media — about anything you want

What we think others around us think has a big effect on our own behavior


The goal is likely to be able to astroturf with aged accounts down the line.


the motive is probably more depressing. a normal human who just wants human interaction. people interacting with something "you" wrote just feels nice and people like that stuff.


Very dense, there is no mineshaft gap left!


I find the thin steering wheels sumptuous.


Trolling us is the real experiment? I suddenly feels angry losing my time reading this submission.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: