- Why are flags often used as modifiers whereas positional parameters are used as targets?
Flags often modify the behavior: it can make a script more or less verbose, or perhaps write the output somewhere. Often, a command manipulates a file, which is then considered the primary target for what the command actually tries to achieve. - Why do we run getopts in a while loop?
All flags are parsed sequentially, and when getopts can no longer find new flags it will return an exit code different from 0, which will exit the while loop at exactly the right moment. - Why do we need a ?) in the case statement?
We cannot trust the user to correctly use all flags all the time. ?) matches any flag we have not specified, which we can then use to inform the user of incorrect usage. - Why do we (sometimes) need a :) in the case statement?
The :) is used when the optstring specifies an argument...
United States
Great Britain
India
Germany
France
Canada
Russia
Spain
Brazil
Australia
Singapore
Hungary
Philippines
Mexico
Thailand
Ukraine
Luxembourg
Estonia
Lithuania
Norway
Chile
South Korea
Ecuador
Colombia
Taiwan
Switzerland
Indonesia
Cyprus
Denmark
Finland
Poland
Malta
Czechia
New Zealand
Austria
Turkey
Sweden
Italy
Egypt
Belgium
Portugal
Slovenia
Ireland
Romania
Greece
Argentina
Malaysia
South Africa
Netherlands
Bulgaria
Latvia
Japan
Slovakia