‘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
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    9 months ago

    Note that it is recommended to use “./” before a raw * in globs to avoid filenames beginning with “-” being interpreted by the command as special arguments

    Jackpot! I think! Based on OP’s reply to me, this is almost definitely the real problem:

    mv *.jpg /mnt/Example/Pictures

    Where it will then die with an error like mv: invalid option -- '1' depending on the contents of the current directory.