I have been using several programs that use the following format when called from the command line:
foo -1 parameter1 -2 parameter2 -3 parameter 3
and the order of the parameters does not matter as long as they are followed by the correct parameter (I am assuming that dashes followed by something are also parameters). So this would be the same as the above:
foo -2 parameter2 -1 parameter1 -3 parameter3
What is the most efficient way to write a bash script that can determine which parameter is which by looking first at the < dash >< something > first? I can see writing a huge flow of control with several if statements but I feel like there should be a better way since so many programs use this format.