Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Aug 2001 04:34:58 -0400
From:      parv <parv_@yahoo.com>
To:        cjclark@alum.mit.edu
Cc:        f-q <freebsd-questions@FreeBSD.ORG>
Subject:   Re: long options in shell script
Message-ID:  <20010817043458.A28979@moo.holy.cow>
In-Reply-To: <20010817011800.P4232@blossom.cjclark.org>; from cristjc@earthlink.net on Fri, Aug 17, 2001 at 01:18:00AM -0700
References:  <20010817015201.A26996@moo.holy.cow> <20010817011800.P4232@blossom.cjclark.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010817043458.A28979>