HACKER Q&A
📣 ent101

If you could reinvent the Linux shell, what would you do differently?


If you could reinvent the Linux shell, what would you do differently?


  👤 Someone Accepted Answer ✓
Don’t make the shell expand glob patterns. Move that to a library for tools to call.

Advantages:

- things like mv *.jpg foo/ work regardless of the number of files matched, avoiding users having to learn find or xargs (https://serverfault.com/questions/315590/how-to-remove-many-...

- it’s much easier to handle arguments containing spaces and other problematic characters

- you can write tools that handle glob patterns differently for some of their arguments without the user having to escape characters

Not really shell issues, but contributing to the mess

- Be consistent in naming tools and arguments

- provide a usable help system (MPW commando is by far the best way I know for letting users compose shell commands. I don’t understand why it hasn’t been replicated)

- there should be a standard way to send higher-level data than streams of characters over pipes. Tables, in particular, would be very nice to have because they would allow for easier composition of commands. Hypothetical example:

   ls foo/ | where filename≈bar.baz | select name,size | max 10
(Powershell is like that, but I would hope there’s a way to do that without going full “send whatever binary data you want: we’ll use reflection to access fields”)

👤 smt88
Arguments before commands.

For example, "rm -Rf /" would become "/ rm -Rf".

I'd do this for two reasons: 1) it's more common to edit your last command than your last argument, and 2) you can't destroy anything by accidentally hitting return at the wrong moment.


👤 billconan
I would create a better scripting language than bash script.

The syntax will be closer to a normal programming language.