Timeline for How can options be parsed in a Bash script, leaving unrecognized options after the "--"?
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 19, 2016 at 8:15 | vote | accept | Steve Amerige | ||
| Oct 12, 2016 at 12:13 | answer | added | Steve Amerige | timeline score: 3 | |
| Oct 12, 2016 at 11:11 | answer | added | rudimeier | timeline score: 0 | |
| Oct 12, 2016 at 10:44 | comment | added | Steve Amerige |
Yes, invalid long options should also terminate parsing. For example, the options -u name1 --unknown -u name2 --username name3 should result in the string: -u 'name1' -- --unknown -u 'name2' --username 'name3'
|
|
| Oct 12, 2016 at 10:27 | comment | added | rudimeier | Should this also work for invalid long options? | |
| Oct 12, 2016 at 10:20 | history | edited | Steve Amerige | CC BY-SA 3.0 |
Clarified that the passed-in arguments do not necessarily include -- in them
|
| Oct 12, 2016 at 9:58 | comment | added | Steve Amerige | Ah, leading colon turns on silent error reporting | |
| Oct 12, 2016 at 9:49 | comment | added | Steve Amerige | In the answer provided by Arvid Requate and edited by TomRoche, there is an initial colon in the optspec. What does that do? Also, I like the "trick" of including -: in the optspec. Is there a way to modify the code so that one would not have to duplicate code for both short and long options? | |
| Oct 12, 2016 at 9:26 | comment | added | Kamaraj | can you check this post answer for your question stackoverflow.com/questions/402377/… | |
| Oct 12, 2016 at 9:24 | history | edited | Steve Amerige | CC BY-SA 3.0 |
clarified
|
| Oct 12, 2016 at 9:17 | history | asked | Steve Amerige | CC BY-SA 3.0 |