.\" .\" CDDL HEADER START .\" .\" The contents of this file are subject to the terms of the .\" Common Development and Distribution License, Version 1.0 only .\" (the "License"). You may not use this file except in compliance .\" with the License. .\" .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE .\" or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions .\" and limitations under the License. .\" .\" When distributing Covered Code, include this CDDL HEADER in each .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. .\" If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" CDDL HEADER END .\" .\" Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany. .\" .\" Sccsid @(#)getopt.1 1.2 (gritter) 6/24/05 .TH GETOPT 1 "6/24/05" "Heirloom Toolchest" "User Commands" .SH NAME getopt \- parse command options .SH SYNOPSIS set \-\- \`\fBgetopt\fP \fIoptstring\fP $*\` .SH DESCRIPTION .I getopt rearranges command options for shell scripts. It accepts an .I optstring argument like .IR getopt (3), i.\|e. a list of characters (bytes) where each character represents an option letter. A character followed by .B : indicates that the option has an argument. When an argument list is passed to .IR getopt , it prints it such that each option forms a separate argument, with option and option argument separated by a space, and a `\-\-' separates options and remaining non-option arguments. For example, `getopt a:bc \-bc \-aarg' results in the output `\-b \-c \-a arg \--'. .SH "SEE ALSO" sh(1) .SH NOTES .I getopt cannot handle arguments that contain white space. For this reason, the shell special command .I getopts is preferred over .IR getopt .