Article View: es.comp.os.linux.programacion
Article #10384Re: [bash] test: too many arguments
From: Ignacio Arenaza
Date: Sun, 03 Mar 2002 10:58
Date: Sun, 03 Mar 2002 10:58
44 lines
2613 bytes
2613 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>>>>> "Benjam�n" == Benjam�n Albi�ana <benjamin@lamanonegra.net.dhis.org> writes:
Benjam�n> /var/spool/news/failed.postings/ + test '!' -z
Benjam�n> 17626-1014994423-1 17626-1014995334-2 17626-1014995688-3
Benjam�n> 17626-1014996193-4 noticias4: test: too many arguments
Benjam�n> Llevo un par de d�as dandole vueltas, y no soy capaz
Benjam�n> de ver d�nde est� el problema. �Alguna idea?
man test ;-)
Ahora en serio, test con la opcion -z solo espera recibir un unico
valor adicional (la cadena de caracteres a comprobar). Tu le estas
pasando multiples cadenas, con lo cual te dice que le das demasiados
parametros.
Si solo quieres ver si hay al menos algun fichero en el directorio,
(presuponiendo que solo hay ficheros y no directorios) puedes hacer
algo como:
num=`dir -1a | wc -l`
if test $num -gt 2 # ponemos 2 porque hay que contar '.' y '..'
then
# Hay al menos un fichero, asi que hacer XXXX
.....
fi
Saludos. I�aki.
- --
Get PGP/GPG Keys at http://www.escomposlinux.org/iarenaza/pgpkey.html
I use free software / Yo uso software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt and GPG
iD8DBQE8ggG+ZXLnGT1HLgcRAvqEAJ4ia5rXINsJ5QlQOgTmcCTSz4RI+QCfZCRE
/aKOm3cdDJoB67FbJi5gXK8=
=Taf4
-----END PGP SIGNATURE-----
Technical Details
Message-ID:
<87g03hapfi.fsf@eb2ebu.ampr.org>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!opentransit.net!newsfeed.comtenidos.com!newsfeeder.wanadoo.es!eb2ebu.ampr.org!not-for-mailReferences:
<slrna7vpjf.mlg.benjamin@lamanonegra.net.dhis.org>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,f967119e962785f0 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2002-03-03 07:31:05 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!opentransit.net!newsfeed.comtenidos.com!newsfeeder.wanadoo.es!eb2ebu.ampr.org!not-for-mail From: Ignacio Arenaza <iarenaza@eb2ebu.ampr.org> Newsgroups: es.comp.os.linux.programacion Subject: Re: [bash] test: too many arguments Date: 03 Mar 2002 11:58:09 +0100 Organization: Servidor NNTP de eb2ebu.ampr.org Lines: 44 Message-ID: <87g03hapfi.fsf@eb2ebu.ampr.org> References: <slrna7vpjf.mlg.benjamin@lamanonegra.net.dhis.org> NNTP-Posting-Host: 62-37-112-11.dialup.uni2.es Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.wanadoo.es 1015169373 8290 62.37.112.11 (3 Mar 2002 15:29:33 GMT) X-Complaints-To: usenet@wanadoo.es NNTP-Posting-Date: Sun, 3 Mar 2002 15:29:33 +0000 (UTC) User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7