4 ms·
I like the use of + to mean the opposite of single dash short options, like with shell options, e.g. `set -e` vs `set +e`. For long options, there's the conven
by jolmg 4y ago
I like the use of + to mean the opposite of single dash short options, like with shell options, e.g. `set -e` vs `set +e`.
For long options, there's the convention of `--no-foo` meaning the opposite of `--foo`, but `+e` hasn't really caught on for short options besides the shell ones.
Being able to negate options, letting the last one win, is useful to be able to define default options in aliases. For example, it might be useful to be able to do this:
$ alias less='less -X'
$ less +X foo.txt
or
$ alias grep='grep -n'
$ grep +nH -r foo *
- mort96 4y agoI find it really confusing when `+x` is used to mean the opposite of `-x`. Usually, the `-x` option means "enable something", which is fine when you think of the "-" as a dash, but introducing `+x` encourages you to think of them as minus and plus; suddenly, in your command's language, "minus x" means "enable x" and "plus x" means "disable x", which makes very little sense. The set command is a great example, "minus e" means "enable error checking" and "plus e" means "disable error checking". That doesn't make sense, that's not what minus and plus means.
- euroderf 4y agoAlso "nice".
- yourad_io 4y agoConsider the semantics: niceness (relinquishes resources) as the opposite of meanness (demands resource) in a multi user system > This is why the nice number is usually called niceness: a job with a high niceness is very kind to the users of your system (i.e., it runs at low priority), while a job with little niceness hogs the CPU. The term "niceness" is awkward, like the priority system itself. Unfortunately, it's the only term that is both accurate (nice numbers are used to compute the priorities but are not the priorities themselves) and avoids horrible circumlocutions ("increasing the priority means lowering the priority..."). Jerry Peek et al. in Unix Power Tools (O'Reilly, 2007, p. 507) via https://stackoverflow.com/questions/14067128/why-are-niceness-values-inversely-related-to-process-priority https://stackoverflow.com/questions/14067128/why-are-nicenes...
- jolmg 4y agoYeah, but beyond that, I can't see any disadvantage to it. It's practical, relatively intuitive syntax. + isn't conventionally used for anything else, being partly conventional for this already, and it works to combine multiple options into one. The fact that they seem backwards seems like something that's easy to get used to over time. It's like electrons being negatively charged.
- jolmg 4y ago> Usually, the `-x` option means "enable something", which is fine when you think of the "-" as a dash, but introducing `+x` encourages you to think of them as minus and plus; To get used to it, one could think of it as a crossed-out dash instead of a plus. Crossed-out means that the dash is disabled.