I know that there are ten different alternatives. Why don’t we simply improve the basic stuff?

  • huf [he/him]@hexbear.net
    link
    fedilink
    English
    arrow-up
    5
    ·
    7 months ago

    i have bad news: bash is already a massively improved/extended ksh clone. ksh was a massively improved/extended sh clone. sh got a ton of improvements early on.

    this is about as good as you can get without breaking compatibility completely (bash already breaks compatibility with posix sh in some ways).

    anyway, once you’ve figured out the hermetic incantations required to work with filenames with whitespace in them, it’ll be time to write scripts that can handle filenames with newlines in them :D

    • palordrolap@kbin.social
      link
      fedilink
      arrow-up
      2
      ·
      6 months ago

      Most shells will issue $PS2 as the continuation prompt if you quote a filename and try to insert a carriage return.

      Ctrl-V Ctrl-J is the explicit keypress pair to insert a carriage return without triggering $PS2, but beware: If the carriage return is outside of quotes, that’s equivalent to starting a new command in much the same way a semicolon or a new line in a shell script would.

      echo "hello^V^Jthere" [Enter] echoes hello on one line and then there on the next, but echo hello^V^Jthere [Enter] will echo hello then try to run a command called there

      We’d have to assume that whatever fixes spaces in filenames would also have an option to fix this subtlety. And I say to whoever tries: Good luck with that.