NeatNit
@NeatNit@discuss.tchncs.de
- Comment on mv *.jpg is complete bullshit. 9 months ago:
Okay, I pretty much agree with you in theory, but in practice you’re basically describing PowerShell which I just cannot. :P
- Comment on mv *.jpg is complete bullshit. 9 months ago:
I’ve been using command-line programs for twenty-five years.
A general statement (not about you):
I’ve been using my human body for over 25 years (exact number withheld) and still don’t know shit about how it works and what it does. I don’t even know the muscle groups, which most people who care about their health learn. But I still use them. Years of experience don’t always translate to understanding and knowledge.
More specifically about you (and me): I’m sure you know a lot about how to use the shell, and I’ll absolutely bet you know more tricks than me to get shit done. But you still didn’t know about the quoting thing. I have a tendency to dig into understanding how shit works while not developing my actual skills in using them. You might have the opposite tendency. The best is somewhere in the middle, I think.
- Comment on mv *.jpg is complete bullshit. 9 months ago:
All I can tell you is that, in my opinion, it’s ridiculous and terrible that old-school terminals haven’t been replaced yet with something more user-friendly and self-explanatory, at least in the same-machine user space. But given that they are what they are, some basic understanding of what shells do is required in order to use them, and you don’t have that understanding (I don’t fault you for this).
The key point here is that programs/commands always receive an array of string arguments, and it’s the shell’s job to translate your command line into that. Quoting (like in
-m=“my message”
), shell variables (like$HOME
) and various other things are processed by the shell and not the program, and the expectation is that the user knows this. So quotes are never visible to programs, and the upside is that programs never need to process such quotes - making these features universal without having various random bugs in each program’s implementation. - Comment on mv *.jpg is complete bullshit. 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.
- Comment on mv *.jpg is complete bullshit. 9 months ago:
Can you run
printf %s\\n *.jpg
in that same directory and share the result? I’m really intrigued. If there’s private information in there, I’d be satisfied with just a handful of lines with private info replaced with ****s - Comment on mv *.jpg is complete bullshit. 9 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?
- Comment on mv *.jpg is complete bullshit. 9 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 - Comment on mv *.jpg is complete bullshit. 9 months ago:
I have two questions:
- Is this some recent news that you expect us to have heard of? Your post demands context that is not easily understood (but it’s possible to understand through multiple reads)
- What shell are you using?
I’m using bash (
GNU bash, version 5.1.16(1)-release
) and don’t observe this behavior:$ ls 'first file.txt' 'second file.txt' $ cat 'first file.txt' this is originally named "first file.txt" $ cat 'second file.txt' this is originally named "second file.txt" $ mv *.txt $ ls 'second file.txt' $ cat 'second file.txt' this is originally named "first file.txt"
It’s possible that whatever shell you’re using has a bug, but it’s definitely not universal. It’s also possible that this bug only affects builtins like
mv
and not non-builtin commands. - Comment on mv *.jpg is complete bullshit. 9 months ago:
What shell are you using? Is this exclusive to
mv
(and maybe other builtins)? - Comment on mv *.jpg is complete bullshit. 9 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.