Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • Yes, I change each --context to -C. Commented Oct 30, 2021 at 11:01
  • The code is intended ta address the portability problem. Have used getopt before. Commented Oct 30, 2021 at 13:30
  • The biggest question is whether to use eval or not, because for the case of getopt, the use of eval seems necessary. Commented Oct 30, 2021 at 13:43
  • @khin, if you have something that's explicitly made to be a shell command, then you use eval. If not, then you don't. Your users probably don't want to enter args with spaces as getopts_test "'foo bar'", instead of the normal getopts_test "foo bar", and they'll probably also expect getopts_test * to work, even if some of the filenames contain whitespace (or shell special characters). Commented Oct 30, 2021 at 17:18
  • For my getopts_test, it like that using an array is a neat idea. What do you think? Customarily, I pass filename as non-option arguments by using the break command. Commented Oct 31, 2021 at 4:39