1. 2

    It always bugs me why we need a shell like syntax? For all those shell clones in lisp, we already have an REPL. What those shell clones do is some kind of parsing the shell syntax and calling lisp functions anyway. You are not going to get a posix compatible shell anyway, then why do it?

    Is it because unix shell has a superior syntax geared toward CLI? Is it mostly because we can save a few keystrokes?

    1. 1

      It is an interesting point. The pipe and redirect syntax is very succinct and powerful though.

      I really like the idea that of something like this that is mostly the same for simple cases (which probably make up 90%+ of my shell usage), but allows you to dip down to the more powerful syntax very easily when the need arises.

      1. 1

        The reason I write a lot of shell scripts is the simplicity of invoking commands, reading and writing files, stdio, pipes, branching on exit codes, command substitution, etc.

        Doing this with things like Python’s subprocess module is a pain, and often requires highly non-obvious things like spawning extra threads to avoid deadlocks, etc. Helper libraries make life much easier, although I agree that altering the syntax to match sh is usually unneccessary.

      1. 5

        This is definitely a quality-of-life thing that you only notice when it’s gone. I typically use it as a function, but since it’s the shell, there’s ten thousand ways to do it. Here’s (my) fish shell version for copy-paste:

        function man -d "Pretty manpages"
            env \
                LESS_TERMCAP_mb=(printf "\e[1;31m") \
                LESS_TERMCAP_md=(printf "\e[1;31m") \
                LESS_TERMCAP_me=(printf "\e[0m") \
                LESS_TERMCAP_se=(printf "\e[0m") \
                LESS_TERMCAP_so=(printf "\e[1;44;33m") \
                LESS_TERMCAP_ue=(printf "\e[0m") \
                LESS_TERMCAP_us=(printf "\e[1;32m") \
                    man $argv
        end
        
        1. 2

          That’s nice. Going to use that for sure.

          FYI fish has a set_color builtin that might make that a bit more readable.