this post was submitted on 20 Feb 2024
-1 points (46.2% liked)
Linux
2439 readers
15 users here now
Shit, just linux.
Use this community for anything related to linux for now, if it gets too huge maybe there will be some sort of meme/gaming/shitpost spinoff. Currently though… go nuts
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Jesus. That's beyond Javascript levels of "helpfully" reinterpreting strings. That's borderline Excel behavior.
What is the point of strings allowing every character besides
\0
if they're gonna eat quotation marks?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"
), variable expansion (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.This is exactly correct. This is why I say it would require a whole new OS with no regard for compatibility with current systems.
As long as arguments are typeless and transmitted in a single array, there is no universal way to make programs distinguish between an option and file name that are identical. Full stop. No way. This has nothing to do with quoting schemes.
There are conventions to work around this (like
--
) but that is at the command level, NOT the shell level. It is not universal.Okay, I pretty much agree with you in theory, but in practice you're basically describing PowerShell which I just cannot. :P
LOL. Now I feel dirty.
To be fair, there's a lot that PowerShell does much better than Bash and similar shells. Piping tables as tables is rad.
I've been using command-line programs for twenty-five years. "Basic" is not the issue, here. This is obscene edge-case behavior for what honestly should be a Hello World level example.
Thoroughly explicable causes do not make the outcome any less of a problem.
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.