Understanding the Command Line: Options, Arguments, and Commands
To tell a command-line application how to do its work, you typically need to enter more than just the name of its executable. For example, we must tell grep which files we want it to search. The database backup app, db_backup.rb, that we introduced in the previous chapter needs a username and password and a database name in order to do its work. The primary way to give an app the information it needs is via options and arguments, as depicted in Figure 1, Basic parts of a command-line app invocation. Note that this format isn’t imposed by the operating system but is based on the GNU standard for command-line apps.[13] Before we learn how to make a command-line interface that can ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access