Ask HN: If you could reinvent the Linux shell, what would you do differently?
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:
(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ā)ls foo/ | where filenameābar.baz | select name,size | max 10Arguments 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.
I would create a better scripting language than bash script.
The syntax will be closer to a normal programming language.