GeeksforGeeks » Interview Questions

getopts usage

(2 posts)
  • Started 6 months ago by rasik12
  • Latest reply from shashikanth
  1. rasik12
    Member
    Posted 6 months ago #

    What is the usage of getopts in unix ?

  2. shashikanth
    guest
    Posted 6 months ago #

    getopts obtains options and their arguments from a list of parameters that follows the standard POSIX.2 option syntax (that is, single letters preceded by a - and possibly followed by an argument value; the single letters may be grouped). Typically, shell scripts use getopts to parse arguments passed to them. When you specify args on the getopts command line, getopts parses those arguments instead of the script command line.


Reply

You must log in to post.

RSS feed for this topic