Hacker News new | ask | show | jobs
by geophile 965 days ago
Marcel (my successof of osh) supports using past commands in a few ways:

1) Command recall, like any shell.

2) Edit of a previous command, giving you access to the command in $EDITOR.

3) Abstraction. For example, suppose you want to find all files recursively, looking for those changed in the last 3 days. You could write:

    ls -fr | select (f: now() - f.mtime() < days(3))
To turn this selection into a reusable command:

    recentN = (| N: select (f: now() - f.mtime() < days(int(N))) |)
This is basically a function on a streams, that takes an input N, and filters for files that changed in the last N days. To use it:

    ls -fr | recent 3
I don't understand what EXPLAIN would do. In SQL, EXPLAIN helps you see the actual implementation chosen for a non-procedural statement. Marcel, nushell, etc. have no optimizer, so there is no invisible execution plan, that would be made visible using EXPLAIN.

Transactions: Might be feasible with a shell built on some kind of COW filesystem, but I'm dubious of how much transaction isolation is really possible even then.