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

Re: [SOLUCIONADO] exportar $DISPLAY



2012/7/25 bruno.debian@cyberoso.com <bruno.debian@cyberoso.com>:
> Si hago el script siguiente :
>
> #!/bin/sh
> HOSTSERVER="e"
> if [ $HOSTSERVER=="ee" ]; then
>         echo "hello"
> fi
>
> Siempre se escribe hello!
>
> Lo siguiente funcionara mejor :
>
> #!/bin/sh
> HOSTSERVER="e"
> if [ "$HOSTSERVER" = "ee" ]; then
>         echo "hello"
> fi
>

En los scripts de Debian siempre veo este estilo:

     if [ "x$HOSTSERVER" = "xee" ] ; then

De esa manera no hay problema si $HOSTSERVER está vacío y mantienen
compatibilidad con otras shell.

El "[" es un alias al comando test, por eso debe haber un espacio tras
el corchete.

Saludos
-- 
A menudo unas pocas horas de "Prueba y error" podrán ahorrarte minutos
de leer manuales.


Reply to: