useradd/usermod not accepting -c [duplicate]
The command you ran contained –c
, which is an en-dash followed by a c
. Although option arguments like -c
are often informally pronounced "dash c" they must actually begin with an ASCII hyphen character. This is the same as the ASCII minus character (one name for this character is "hyphen-minus") but different from other Unicode dash characters like the en dash and em dash.
Commands don't give any special meaning to those dash characters, so while a -c
argument specifies the short option c
, a –c
argument does not specify any option at all. You were actually running usermod
with three non-option arguments, which is not one of the syntaxes it accepts, so it printed its help message.
The reason people end up typing en dashes instead of hyphens in commands is--well, nobody does that. Instead, some websites convert hyphens to en dashes. So when a command is copied from a page of such a website and pasted into a terminal, it wrongly contains an en dash instead of a hyphen. This could also happen if one used a program like LibreOffice to store a list of commands (and didn't turn off autoformatting).
Similar problems that often arise in practice from such mangled text include the insertion of extra spaces near punctuation (very bad in rm -r
commands!), replacement of straight quotes with curly quotes, and the disappearance of text between a <
character and a matching >
character.
The command you meant to run, sudo usermod -c "Richard Tracy" dtracy
, works fine.