3 ms·
Well the argument parser knows that `-u` must take a value, and the only way it can really associate it with its value is positionally (i.e., the value is the s
by okdana 10y ago
Well the argument parser knows that `-u` must take a value, and the only way it can really associate it with its value is positionally (i.e., the value is the stuff that immediately follows it). So it could force you to make the value a separate argument, but that would be a purely arbitrary restriction — it couldn't allow anything but the value to follow, so it'd just have to return an error for the sake of it.
This behaviour is defined in POSIX, btw:
>If the SYNOPSIS of a standard utility shows an option with a mandatory option-argument (as with [-c option_argument] in the example), a conforming application shall use separate arguments for that option and its option-argument. However, a conforming implementation shall also permit applications to specify the option and option-argument in the same argument string without intervening <blank> characters.
- lucb1e 10y agoOh, I had never thought of it like that. That makes sense! I just treated those commands (like mysql) as one of those commands where -every -option -must -be -separate. I suppose I don't mind that syntax anymore now. Thanks for changing my mind :)