Chapter 9. UNIX Command-Line Processing

Anyone who has been using UNIX at the shell prompt for a time has unwittingly become acquainted with how UNIX commands work. Some of the most frequently used commands—ls(1), mv(1), cp(1), rm(1), and ln(1), for example—use the same general command-line conventions.

This level of consistency is a result of a convention being adopted by UNIX developers and a library mechanism to make it easy to adhere to. In this chapter, you will look at

  • UNIX command-line conventions

  • Parsing command lines with getopt(3)

  • Parsing suboptions with getsubopt(3)

  • Parsing command lines with the GNU's getopt_long(3)

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.