Live data from Hacker News

A Bourne-style shell built from scratch in 35 minutes [video]

destroyallsoftware.com

61–70 of 71 posts

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#61
post #24
post #19

By the way, IMHO much of the ugliness of shells comes from the requirement that simple filenames are to be used without additional escape characters. I think we should ditch that requirement.

My fantasy crosscutting change is outlawing spaces in filenames, at the filesystem level!

and uppercase.

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#62
post #24

Earlier quoted context omitted.

My fantasy crosscutting change is outlawing spaces in filenames, at the filesystem level!

my fantasy is they design a shell language where it's impossible to write anything that fails if there are spaces in filenames

That's much better than what the parent wants. Almost always whenever I write any script almost 25% of the time is spent ensuring it doesn't break due to spaces or special unescaped characters.

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#63

Then 35 weeks to get POSIX job control, pipes, handling signals and whatnot. 35 years to find the last bug.

The video isn't advertising this as a shell you'd use in production.

It's an interesting resource to learn how shells work and are implemented. It doesn't cover absolutely everything, but it was never meant too.

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#64
post #62

Earlier quoted context omitted.

my fantasy is they design a shell language where it's impossible to write anything that fails if there are spaces in filenames

That's much better than what the parent wants. Almost always whenever I write any script almost 25% of the time is spent ensuring it doesn't break due to spaces or special unescaped characters.

You already have that. Just write your script in one of the countless sane languages that are #!-able.

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#66
post #31
post #13

Earlier quoted context omitted.

I think the original poster does not want to output escape codes, he wants to build a terminal that will accept escape codes like a xterm. This way, he won't need to create a new terminal type with all the terminfo or ncurses configuration.

The two other terminal multiplexers I know of are GNU screen and tmux. GNU screen defines its own “screen” terminal type in terminfo, and tmux shamelessly re-uses it and claims to be “screen-256color” (screen with 256 colors). So I don’t think there is any good way to avoid it.

>"shamelessly re-uses it and claims to be “screen-256color”

Could you elaborate on this? Tmux uses the screen terminfo entry? Is it not actually 256?

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#67
post #64
post #62

Earlier quoted context omitted.

That's much better than what the parent wants. Almost always whenever I write any script almost 25% of the time is spent ensuring it doesn't break due to spaces or special unescaped characters.

You already have that. Just write your script in one of the countless sane languages that are #!-able.

until your script needs to launch/spawn another app/script/command/program.

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#68
post #64

Earlier quoted context omitted.

You already have that. Just write your script in one of the countless sane languages that are #!-able.

until your script needs to launch/spawn another app/script/command/program.

Doesn't necessarily have to be a major hassle. With my homemade Lisp, here's a quick and dirty shorthand for running external programs (ultimately boiling down to fork+exec):

    (extend-parser "!"
                   (mac (cmd) `(apply run (map to-string ',cmd))))

    !(sed "s/foo/bar/" README)

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#69

On this note, I need to build my own Terminal multiplexer - does anyone have a favorite primer of theirs for all the escape codes? Not only do I need to use them myself, but I need to handle them of child processes to restrict term sizes etc. I can Google like ya'll - I'm just asking if there are any favorite resources :) Thanks

why do you want to build your own multiplexer? is it just to learn the tech, or do you find screen/tmux aren't what you're looking for? (if the latter, what's lacking?) i'm not trying to say it's not worth building your own, i'm just curious.

Sorry, missed your comment.

Yes, to learn the tech - but also to toy with ideas. I've been using Kakoune recently after years of Vim and while I enjoy it, it makes me wonder many things. After much speculation to myself, I decided to try implementing my ideas. I mainly expect them to fail, in the UX department at least, but I have to use it to really flesh it out.

This may sound more editor oriented, and you'd be right, but for a simplest explanation a self made multiplexer like tmux/etc will be involved.

Re: A Bourne-style shell built from scratch in 35 minutes [video]

#70

Earlier quoted context omitted.

why do you want to build your own multiplexer? is it just to learn the tech, or do you find screen/tmux aren't what you're looking for? (if the latter, what's lacking?) i'm not trying to say it's not worth building your own, i'm just curious.

Sorry, missed your comment. Yes, to learn the tech - but also to toy with ideas. I've been using Kakoune recently after years of Vim and while I enjoy it, it makes me wonder many things. After much speculation to myself, I decided to try implementing my ideas. I mainly expect them to fail, in the UX department at least, but I have to use it to really flesh it out. This may sound more editor oriented, and you'd be rig…

cool! good luck.
Post reply on HN