Every time someone complains about Guile's scsh port, you are obliged to post a patch here to improve it.
Use this as the base: https://gitlab.com/guile-scsh/guile-scsh
Happy hacking!
This fixes the issues that make it unable to run on Guile 3.0.2: https://paste.textboard.org/37618cbc
Meta: What does Guile scsh offer over bash (besides being probably more hackable)? Is it kind of like Eshell?
>>1
Good one.
Who wants to adopt the repo?
Help me out, why work on guile-scsh instead of gash?
>>3,6
I don't exactly get what the hype around scsh is, but I think the idea is the following:
Unix shells provide a single language for two purposes: 1) interactively executing commands, and 2) writing scripts. It is clear that they were designed for the first case, the second being only an afterthought. I think Eshell is only capable of the first one. Meanwhile, scsh was designed for scripting and programming, with proper lexical scoping, data-structures, everything a programmer could want (coming from Scheme), but with a convenient interface to the system that resembles the ease-of-use provided by the shell.
Meanwhile Gash is an implementation of the POSIX sh.
>>7
So how does it differ from a Scheme implementation with a POSIX library?
>>8
Flip through the manual: https://scsh.net/docu/html/man.html
I think the most important is the process notation. Here's an example from the manual:
(run (| (delatex)
(begin ((char-filter char-downcase))) ; tr A-Z a-z
(spell)
(sort)
(uniq))
(< scsh.tex)
(> spell-errors.txt))
The begin
is Scheme, the rest are shell commands.
(begin ((char-filter char-downcase))) ; tr A-Z a-z
The begin is Scheme
Since it is given one argument, it is much more likely to be a custom, redefined begin, not the standard one.
>>10
It is the `escape-to-scheme' case of the process forms, it behaves like `begin' but is run in a fork. For example:
(run (pipe
(begin
(display "Hello SchemeBBS!")
(newline)
(display "How are you doing?")
(newline))
(wc -l)))
This will output 2.
It is a somewhat common mistake in bash to try to modify the environment of the parent shell from a child shell in a pipeline. Here it is in scsh:
(let ((maximum 0))
(run (pipe
(seq 100)
(begin
(let loop ((l (read-line)))
(when (not (eof-object? l))
(when (> (string->number l) maximum)
(set! maximum (string->number l)))
(display l)
(newline)
(loop (read-line)))))
(wc -l)))
(display (list 'maximum maximum)))