[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: options for menu packages



On Tue, 16 Dec 1997, Adrian Bridgett wrote:

>   /usr/X11R6/bin/pppload -i 2 -p 10

[...]

>   /usr/X11R6/bin/pppload $(tail -n +2 /etc/pppload)

[...]

>   /usr/X11R6/bin/pppload \
>     $(grep -v ^\# \
>       $(if [ -r ~/.pppload ]; then \
>         echo ~/.pppload; \
>       else \
>         echo /etc/pppload; \
>       fi))

Gack!

I see a couple of problems with this.  First, "-i 2 -p 10" makes a bit of a
silly looking configuration file.  Secondly, placing any of the above
commands in your "menu" entry seems wrong to me -- if the user runs pppload
from the command line, he doesn't get the same settings as starting it from
the menu!

Best thing to do is rename /usr/X11R6/bin/pppload to, say, pppload.real and
make a shell script containing the last command above with an added "$*"
parameter passed to pppload.real.  Actually, in the ideal case you would
parse a nicely-formatted configuration file (with real words) into the
desired options, so you could have lines like
	interval 2
and so on.

You could do this with perl, awk, or if you're truly sick, even sed:

	cat configfile 			\
		| sed 's/#.*$//'	\
		| tr '[A-Z]' '[a-z]' 	\
		| sed s/interval/-i/g

Yikes.  Excuse me, now I'm even making myself crazy.

Avery

P.S. '#' comments should be allowed even if they aren't at the beginning of
	a line.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: