I'm curious - is there a difference between
ls -l and
The output appears to be the same and I'm confused on why
ls allows duplicate switches. Is this a standard practice among most commands?
Because it's programmed to ignore multiple uses of a flag.
As you can see in the source code of
Well, it changes one thing. This huge switch case statement must run through multiple times, because of multiple
Because it's the right thing to do. Suppose you had a script doing something like:
where it's possible that
Shell aliases would be pretty annoying if commands like
Suppose you had
Then, if conflicting flags were not allowed, it would be an error to issue commands like
Therefore, these commands are designed to let later flags override earlier ones.