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*

3
  • 6
    Using $* is broken usage of getopt. (It hoses arguments with spaces.) See my answer for proper usage. Commented Apr 16, 2016 at 14:37
  • Why would you want to make it more complicated? Commented Aug 10, 2017 at 14:07
  • 1
    @Matt J, the first part of the script (for i) would be able to handle arguments with spaces in them if you use "$i" instead of $i. The getopts does not seem to be able to handle arguments with spaces. What would be the advantage of using getopt over the for i loop? Commented Jun 1, 2018 at 1:57