From owner-freebsd-questions Fri Aug 17 1:35: 3 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mtiwmhc23.worldnet.att.net (mtiwmhc23.worldnet.att.net [204.127.131.48]) by hub.freebsd.org (Postfix) with ESMTP id 09B3037B40C for ; Fri, 17 Aug 2001 01:34:59 -0700 (PDT) (envelope-from parv@worldnet.att.net) Received: from worldnet.att.net ([32.100.199.11]) by mtiwmhc23.worldnet.att.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with ESMTP id <20010817083457.CQEO8490.mtiwmhc23.worldnet.att.net@worldnet.att.net>; Fri, 17 Aug 2001 08:34:57 +0000 Received: by worldnet.att.net (Postfix, from userid 1001) id B63C150F46; Fri, 17 Aug 2001 04:34:58 -0400 (EDT) Date: Fri, 17 Aug 2001 04:34:58 -0400 From: parv To: cjclark@alum.mit.edu Cc: f-q Subject: Re: long options in shell script Message-ID: <20010817043458.A28979@moo.holy.cow> Mail-Followup-To: cjclark@alum.mit.edu, f-q References: <20010817015201.A26996@moo.holy.cow> <20010817011800.P4232@blossom.cjclark.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010817011800.P4232@blossom.cjclark.org>; from cristjc@earthlink.net on Fri, Aug 17, 2001 at 01:18:00AM -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG this was, on the fateful occasion around Aug 17 04:18 -0400, sent by Crist J. Clark > > On Fri, Aug 17, 2001 at 01:52:01AM -0400, parv wrote: > > i got tired of making symlinks to a script and behaving depending on > > basename. > > > > so i am searching for a way to implement long options (bourne shell). > > does anybody have short example or where to find one? > > Not sure what you mean by this. ok, here is an explanation by example. does anybody have a bourne shell parsing algorithm to parse long options like --help, --style 2, --verbosehigh, etc? in this example... --help is standalone option, --style option needs a required argument one of which is "2", and --verbose has various options, one of which is "high". > > another question, is it possible to write "module" in bourne shell > > and be usable in other sh scripts? > > You can put some shell functions in a file and load it, > > $ cat myfunctions > > sample_func ( ) { > echo "Sample function" > } > > $ cat loadingfile > #!/bin/sh > > . myfunctions > > sample_func > that was easy. thanks. -- so, do you like word games or scrabble? - parv To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message