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:

       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ā€)

  • 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.

  • I would create a better scripting language than bash script.

    The syntax will be closer to a normal programming language.