El Lunes, 17 de Octubre de 2005 21:53, Jeremy Huntwork escribió:
> Seth W. Klein wrote:
> > case $i in *groff)
>
> Manuel, do you mind if we switch over to this method of string
> comparisons in jhalfs? David's method is nice, but the syntax Seth
> suggests is easier to read and doesn't result in forks. Also it doesn't
> require a specific string format.
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
IMHO, that is the more cleanest, readable and portable solution.
Many thanks for your inputs, especially to George B. for send to me several
different implementations and solutions, included that.
--
Manuel Canales Esparcia
Usuario de LFS nº2886: http://www.linuxfromscratch.org
LFS en castellano: http://www.escomposlinux.org/lfs-es http://www.lfs-es.com
TLDP-ES: http://es.tldp.org
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page