Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In the 2000s, I was running extensive sets of simulations and data reduction scripts for a scientific experiment, and I was heavy relying on scripts to run the programs, collect the results, and distribute them over several servers. At first I developed those scripts using bash, but I needed to do math and complex iterations over file names and different parameter files, and I continuously stumbled upon weird behaviors and had to rely to hard-to-understand quirks like the ones explained in the article (which bit me more than once!).

After a while I stumbled upon scsh [1], which at first didn't impress me because I ran it as an interactive shell, and from this point of view it was really ugly. But then I realized that scsh was primarily meant as a way to run shell scripts, and I immediately felt in love. I had the power of a Scheme interpreter, the ability to easily use mathematical expressions (the awesomeness of Scheme's numerical tower!) and macros, and a very effective way to redirect inputs and outputs and pipe commands that was embedded in the language [2]!

In those years I used scsh a lot and developed quite complex scripts using it, it was really a godsend. Unfortunately the program got abandoned around 2006 because it was not trivial to add support for 64-bit architectures. However, while writing this post I've just discovered that somebody has revived the project and enabled 64-bit compilation [3]. I would love to see a revamp! Nowadays I use Python for complex scripts, but it's not the same as a language with native support for redirection and pipes!

[1] https://scsh.net/

[2] https://scsh.net/docu/html/man-Z-H-3.html#node_chap_2

[3] https://github.com/scheme/scsh



Whenever I need a quick script I use bash. If that script goes beyond 20 lines or has anything but the simplest `if` or `&&`, I've learned time and time again that I should rewrite it (python for example)



> Nowadays I use Python for complex scripts, but it's not the same as a language with native support for redirection and pipes!

While this is no doubt right, I think you could build a little abstraction that simplified piping syntax considerable. The subprocess module is not terribly convenient, although it has gotten less confusing over the years.

Python does have operator overloading, so you could even make it fancy.


There are a lot og libs that do that, but few people use them because it's not native to the language.

This is an important point for scripting as nobody wants to setup a venv to run a simple script.

Zippapp are a solutions to that but most people don't know abot them. Also, it's not convenient enough to make at the moment.


> However, while writing this post I've just discovered that somebody has revived the project and enabled 64-bit compilation [3].

That is excellent news, if it comes to anything. At present it looks like it's still dependent on the 32-bit Scheme48. Is there a roadmap for this project?

> Nowadays I use Python for complex scripts, but it's not the same as a language with native support for redirection and pipes!

Note that Guile has support for both these. But it doesn't have the shell-tool minilanguages in it that scsh does, like the one for awk.


I was very surprised to see scsh mentioned in this thread. I'm glad to read that it was of some use for you.


I had a very similar experience with using scsh for shell scripts instead of bash and it was great and far more convenient than using Python or any other language with poor support for the shell style of command execution.

I have also been forced to revert to bash later so it is good to know that there might be an update for it.


Have you seen python's sh module?


Wait till you learn about Python lmao

For simplish parallel runner https://www.gnu.org/software/parallel/ is excellent, can even automate stuff like "copy a file to remote server then run command on it" so you can make simplistic cluster computing with it


parallel is even great for non-parallel things because of its simple CLI handling and transformation of filenames (`{}`, `{.}`, `{/}`, etc.)

e.g. `ls old/*.jpeg | parallel mv {} new/{/.}.jpg` is easier than a bash loop.[1]

[1] Yes, it should be `find -print0` or something, blah blah, it's an example.




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

Search: