Every time we publish a Linux hack that uses a shell script, someone will chime in about how awful it is to program shell scripts. While we like the ubiquity and efficiency, we can’t disagree that the shell is a bit of a hack itself. [Axel Lijencrantz] wants to change your shell to be a full-blow programming language called Crush.

On the face of it, it looks like a shell. Want to see the contents of the current directory? Simple: ls.

The difference is underneath. In Crush, ls is a built-in and it returns data in rows like a database. You can manipulate that database with SQL-like commands: ls | where {type=="directory"}.

You can still treat I/O as binary streams. But Crush also knows about CSV files, JSON, line-oriented files, and several other formats. So if you were trying to feed the output of ls to a program and need it in JSON form, that’s simple: ls | json:to ./listing.json.

Crush can also do math without resorting to trickery like older shells or strange syntax like bash. The shell supports closures that you can assign to a variable to make what amounts to a function. Another welcome feature is that Crush understands the idea of namespaces.

There are a few oddities like using % as a wildcard instead of * because the * is for multiplication. However, we like a lot of the features, including simplified remote execution and the ability to create custom types.

Crush is similar to Nu, but has some different goals with respect to programming languages. If you are still writing programs in traditional shells like bash, be sure to run a linter.

…read more

Source:: Hackaday