Deutsch English Français Italiano |
<uvjdu1$b327$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.unix.shell Subject: Re: Which shell and how to get started handling arguments Date: Mon, 15 Apr 2024 16:34:41 +0200 Organization: A noiseless patient Spider Lines: 26 Message-ID: <uvjdu1$b327$1@dont-email.me> References: <uvj65n$9aep$1@dont-email.me> <uvjc3n$akii$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Mon, 15 Apr 2024 16:34:42 +0200 (CEST) Injection-Info: dont-email.me; posting-host="7442213264ab8592460c4ec71b7997a1"; logging-data="363591"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ba6Wo5LWLYSfxlO/dKtvk" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:GA3X+5xoPupt7XZVSDPc7clDw9Q= In-Reply-To: <uvjc3n$akii$1@dont-email.me> X-Enigmail-Draft-Status: N1110 Bytes: 2023 On 15.04.2024 16:03, Janis Papanagnou wrote: > On 15.04.2024 14:22, James Harris wrote: >> >> I read up on getopts > > It's the right tool. > >> but from tests it seems to require that switches >> precede arguments rather than allowing them to be specified after, so >> that doesn't seem very good, either. > > That's the usual convention, first come the options (with optional > arguments), then the non-option arguments. Here's a syntax example > > yagol [-s] [-w width] [-h height] [-g[ngen]] [-d density] > [-i infile] [-o outfile] [-r random-seed] [-u rule] > [-k|-t[sec]|-l|-f] [-p|-n|-c] [-a[gen]] [-m[rate]] Please ignore that example (I forgot it's C code using 'getopt()' from the GNU C library). The features differ in some ways. For ksh's 'getopts' type in a ksh terminal 'getopts --man' to get a more extensive manual information than that you find in 'man ksh'. Janis