Show HN: Forsh – A Unix shell embedded in Forth
bitbucket.org
Show HN: Forsh – A Unix shell embedded in Forth
1–10 of 23 posts
Re: Show HN: Forsh – A Unix shell embedded in Forth
#2Re: Show HN: Forsh – A Unix shell embedded in Forth
#31) I made Unix commands a first-class variable type. You could create a single Unix command and store it into a variable. You could also set up several commands as a pipe, and save that into a variable.
2) redirection and pipes are more Forth in style. Much like adding two values:
2 3 +
To create a pipe, you create the two commands and then pipe them: cmd1 cmd2 |
I'm looking over the code, and I don't think I finished redirection to tell the truth, but I can see it being easy to add it like: cmd1 "filename" |
since variables are typed in my Forth-like language.It was a fun project to write (it even included history!) but as a practical shell? Not so much. The syntax left much to be desired for an interactive shell.
[1] Unix systems programming. The class project was a Unix shell. I had, by that time, already written a Forth-like programming language on my own [2], which meant I could do the advanced shell (programmable) instead of the simple shell (command execution and redirection only).
[2] I was seriously interested in Forth at the time.
Re: Show HN: Forsh – A Unix shell embedded in Forth
#4Re: Show HN: Forsh – A Unix shell embedded in Forth
#5Didn't the old Sun workstations boot into a Forth interpreter?
Re: Show HN: Forsh – A Unix shell embedded in Forth
#6Didn't the old Sun workstations boot into a Forth interpreter?
Yes they did.
Re: Show HN: Forsh – A Unix shell embedded in Forth
#7Shell Has a Forth-like Quality
Re: Show HN: Forsh – A Unix shell embedded in Forth
#8Re: Show HN: Forsh – A Unix shell embedded in Forth
#9Didn't the old Sun workstations boot into a Forth interpreter?
Re: Show HN: Forsh – A Unix shell embedded in Forth
#10Didn't the old Sun workstations boot into a Forth interpreter?
Was / is Forth good and useful? Bonus; is it fun?
One thing that's nice about the language is that it's the simplest language you can implement on your own without going insane!