Re: SCRIPT: head

From: Michele Andreoli (m.andreoli@tin.it)
Date: Wed Nov 08 2000 - 10:28:28 CET


On Tue, Nov 07, 2000 at 10:57:49PM +0100, Jean Buchet nicely wrote:
>
> With Michele's advice, it could be something like
> #/bin/awk -f
> (NR<max=((argv[2]=="")?10:(argv[2]<0)?-1*argv[2]:argv[2])) { print $0 }
>

Here a question about muLinux "mawk": it seems a little buggy, as far
the argv[] is concerned. The parameters passing do not works as
expected. I alway used a C wrapper called /usr/bin/muawk, to use awk
as interpreter in the scripts.

You have to put as first row:

                #!/usr/bin/muawk

then, in the program, you have your parameter in the string variable "arg".
Now, you can split the variable "arg" and store in a regular array,
for example "opts":

                n=split(arg,opts)

Your parameters are now in opts[].
>
> PS:
> >I like small scripts... for mu
> Small is beautiful!

A questionable matter :-))
Michele

-- 
"I'd like to conclude with a positive statement, but I can't remember any.
Would two negative ones do?"			-- Woody Allen
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk


This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:16 CET