jhalfs: Ready to go.

Jeremy Huntwork jhuntwork at linuxfromscratch.org
Tue Oct 25 07:03:54 PDT 2005


M.Canales.es wrote:
> The method implemented few minutes ago is based on that, but instead to change 
> all "if" to "case" a function based in "case" string text has been added and 
> that function is used inside the "if".
> 
> #-----------------------------------------------#
> _IS_()  # Function to test build scripts names
> #-----------------------------------------------#
> {
>   # Returns substr $2 or null str
>   # Must use string testing
>   case $1 in
>     *$2*) echo "$2" ;;
>        *) echo ""   ;;
>   esac
> }
> 
> 
>     if [[ `_IS_ $i adjusting` ]] ; then
> 

The idea of keeping the code cleaner by using a function is nice, 
however I disagree that this is more readable. Plus it appears that it 
would just be that much slower because we're using if and case in 
tandem, when a case alone would have sufficed.

I'm of the opinion that leaving it at a simple case switch would have 
been the best. Does anyone else have an opinion? Does it really matter? 
If it doesn't I guess we could leave it as it is, though, again, 
personally, I would prefer we use a simple case switch each time we need it.

--
JH



More information about the lfs-dev mailing list