From: Miguel Angel (maacruz@navegalia.com)
Date: Mon Apr 24 2000 - 20:33:14 CEST
El Sun, 23 Apr 2000, :"Alfie Costa" <agcosta@gis.net> kindly wote:
> Some 'ash' script observations and/or questions:
> 
> 1) In 'profile' there's a macro for this new '/bin/echo'.  
> 
> Assuming that 'ash's built-in 'echo' is faster than an external program, (maybe 
> it isn't -- on general principles it should be though.), wouldn't this slow 
> down every script that uses 'echo'?  One fix would be to rename this new 
> '/bin/echo' to '/bin/echobin', and call it with 'echobin'.
I patched /etc/profile to make echo work always as i expected, not being so
concerned about speed questions. I think there is no noticeable speed loss,
anyway.
 
> 2) A tweak.  Anything like 'if [ "$reverse" != "" ]' can be reduced to 
> 'if [ ${reverse} ]'.  Possibly it's not as obvious what that code does; my 
> defense would be that mu's microscopic size is one of it's best features. 
Ok,though 5 bytes is not a lot of space :-)
> 3) In 'binpatch't, there's some 'awk' code... 
> 
>   pos=`echo|$AWK "{print( $pos-1 )}"`
> 
> It looks as if the goal is to subtract one from 'pos'.  If that's true, then 
> this is faster:
> 
>   pos=`expr "$pos" - 1`
You are right. In ash there is no builtin arithmetic, so i used awk, i missed
completely "expr". Thanks for pointing this out.
> 4)Also from 'binpatch' is this redirection code: 
> 
>   $ECHO -n -e "$byte" | \
>     dd of=$1 bs=1 seek=$pos count=1 conv=notrunc>/dev/null 2>&1
> 
> If 'dd' has an output file (of=$1) then nothing ever gets sent to standard 
> output, only perhaps to standard error.  So, this would be simpler:
> 
>     ... dd of=$1 bs=1 seek=$pos count=1 conv=notrunc 2> /dev/null
Yes, you are right again. Being harmless I forgot it from early stages of the
script
> Well, that's it so far; thanks for writing and sending out this useful
script,  
> and hope the above is somehow helpful...
Thanks to you all for trying it :-)
--
Don't see the world trought a window, be open{source}minded, and be free :-)
---------------------------------------------------------------------
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:14 CET