‘Well it’s only passing mv a list of–’ yeah yeah yeah, I know, and that’s why I’m calling bullshit. It should be massively harder to execute filenames. Even if 1970s decisions make that the eternal hideous default: the lack of any idiot-proof standard workaround is incomprehensible.

StackOverflow’s full of competing one-liners and people pointing out how each one is considered harmful. The least-skeezy options use exec. That sentence should make anyone recoil in horror.

This is not a filename problem. This is a tool problem. If a single printable character is going to silently expand into a list of names, then for god’s sake, having it put each name in quotes should be fucking trivial.

    • NeatNit@discuss.tchncs.de
      link
      fedilink
      arrow-up
      3
      ·
      10 months ago

      I’m also a bit lost. From the final sentence “having it put each name in quotes should be fucking trivial.” OP seems to complain that filenames with spaces expand into multiple arguments. I can’t recreate this with this command in bash:

      $ printf %s\\n *.jpg
      

      This command prints each argument in its own line. Replace *.jpg with whatever to prove it to yourself. Filenames with spaces show in full in a single line for me.

    • mindbleach@sh.itjust.worksOP
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      10 months ago

      It expands *.jpg into a list of names.

      Which you’d think would mean mv "thing.jpg" "other thing.jpg", but no, it does mv thing.jpg other thing.jpg - and then chokes, because other is not a valid option or filename. Possibly after writing the contents of other thing.jpg onto the destination thing.jpg.

      If any filenames contain characters like ; or &, you better hope the next word doesn’t look like a command.

      • NeatNit@discuss.tchncs.de
        link
        fedilink
        arrow-up
        3
        arrow-down
        2
        ·
        edit-2
        10 months ago

        What shell are you using? Is this exclusive to mv (and maybe other builtins)?

        Edit: also why would you ever want to move files like this, what is wrong with you

        • mindbleach@sh.itjust.worksOP
          link
          fedilink
          arrow-up
          2
          arrow-down
          4
          ·
          10 months ago

          Edit: also why would you ever want to move files like this, what is wrong with you

          … like what?

          The fuck do you mean, why would I want to move files in a terminal? Because I’m doing shit in a terminal! What, do you expect people to Super+E, find the directory they’re in, and drag-and-drop? I’m using tools that only exist in the command line.

          I’m using whatever GNOME Terminal came with Linux Mint 20 by default. StackOverflow answers sound like any POSIX terminal will do this. I assume it’s standard behavior.

          • NeatNit@discuss.tchncs.de
            link
            fedilink
            arrow-up
            2
            ·
            10 months ago

            I’m using whatever GNOME Terminal came with Linux Mint 20 by default.

            Should be bash. Type help it should tell you.

            StackOverflow answers sound like any POSIX terminal will do this. I assume it’s standard behavior.

            Link?

          • NeatNit@discuss.tchncs.de
            link
            fedilink
            arrow-up
            2
            arrow-down
            1
            ·
            edit-2
            10 months ago

            I mean with * where you have no control of the order of the files and you never explicitly say which files are being moved. “yeah, just rename files into other files, I don’t fucking care lol” is what your command does