- 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
Ukraine
Luxembourg
Estonia
Lithuania
South Korea
Turkey
Switzerland
Colombia
Taiwan
Chile
Norway
Ecuador
Indonesia
New Zealand
Cyprus
Denmark
Finland
Poland
Malta
Czechia
Austria
Sweden
Italy
Egypt
Belgium
Portugal
Slovenia
Ireland
Romania
Greece
Argentina
Netherlands
Bulgaria
Latvia
South Africa
Malaysia
Japan
Slovakia
Philippines
Mexico
Thailand