🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #7469

Re: Comparar cadenas con el shell

#7469
From: Pascal Bourguignon
Date: Wed, 26 Feb 2003 17:45
46 lines
1922 bytes
"Splash" <pericles98@hotmail.com> writes:

> Hola,
> 
> estoy intentando sin exito comparar una cadena que contiene un numero (por
> ejemplo "1023") con un n�mero con el tcsh, pero no encuentro ninguna funcion
> que me lo haga directamente. �Podeis darme alguna sugerencia?

No he visto que haya ninguna diferencia entre n�meros y cadenas en los
shells.

Para empezar,

    set a="toto" 

es igualito a:

    set a=toto

y
    
    set n=4012

es igual a

    set n="4012"

En todo casos,

    set a=12
    set b="12"
    if ( $a == $b ) then
        echo igual
    else
        echo diferente
    endif

da:

    igual


-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie
Technical Details
Message-ID: <87heardjgy.fsf@thalassa.informatimago.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.tu-darmstadt.de!fu-berlin.de!uni-berlin.de!213.220.35.225!not-for-mail
References: <Ug17a.171$7b.4888@news1.nokia.com>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,15da841a012300fd
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2003-02-26 09:45:26 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.tu-darmstadt.de!fu-berlin.de!uni-berlin.de!213.220.35.225!not-for-mail
From: Pascal Bourguignon <pjb@informatimago.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Comparar cadenas con el shell
Date: 26 Feb 2003 18:45:17 +0100
Organization: informatimago.com
Lines: 46
Sender: pascal@thalassa.informatimago.com
Message-ID: <87heardjgy.fsf@thalassa.informatimago.com>
References: <Ug17a.171$7b.4888@news1.nokia.com>
NNTP-Posting-Host: 213.220.35.225
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 1046281525 57335049 213.220.35.225 (16 [41911])
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50