Article View: es.comp.os.linux.programacion
Article #7886Re: bash y passwd
From: Iñaki Arenaza
Date: Sat, 18 Jan 2003 16:26
Date: Sat, 18 Jan 2003 16:26
44 lines
2838 bytes
2838 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>>>>> "zd" == zd <zeldere_nntp@yahoo.es> writes:
zd> Lo que ocurre es que grep produce una salida distinta de
zd> cero como t� ya has indicado. La raz�n de �sto es que no se ha
zd> usado la sustitu- ci�n de �rdenes como se deber�a haber
zd> hecho. Es decir:
Estooo, �se puede decir "paparruchas" en este grupo? Pues eso,
�paparruchas!
En este caso no quiere quedarse con la linea (si existe) de texto
donde aparece el usuario. Solo quiere ver si hay al menos una linea de
esas. Y aparentemente esta bien salvo error de tecleo. Yo simplemente
a�adiria un '-q' a la ejecucion de grep para que ni siquiera saque por
pantalla el texto de la linea si esta esta en el fichero.
En todo caso, es mucho mas facil, comodo y seguro usar la orden
getent (si se usa NIS, NIS+, LDAP u otros sistemas de cuentas de red,
el metodo de grep puede no encontrar usuarios que realmente si existen):
alumno=juanito
if getent passwd $alumno > /dev/null
then
echo si existe
else
echo no existe
fi
Saludos. I�aki.
- --
Get PGP/GPG Keys at http://www.escomposlinux.org/iarenaza/pgpkey.php
I use free software / Yo uso software libre
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 <http://mailcrypt.sourceforge.net/>
iD8DBQE+KYBJZXLnGT1HLgcRAqaBAJ9lDTnxa/ydsnRmyz7mc7QrohWnWACdGnjS
HK1IO1dL4tEbJEzIDWXztF0=
=5b7M
-----END PGP SIGNATURE-----
Technical Details
Message-ID:
<87k7h2e851.fsf@barad-dur.escomposlinux.org>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!news.eteo.mondragon.edu!not-for-mailReferences:
<2conf-lb2.ln1@paldaria.dsland.org> <b0bkkt$m62$1@titan.bt.es> <20030118145909.6d0ac8e3.444398@celes.unizar.es> <b0bq1p$onm$1@titan.bt.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,a0ddc9dad727a552 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2003-01-18 08:26:53 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!news.eteo.mondragon.edu!not-for-mail From: iarenaza@eb2ebu.ampr.org (Iñaki Arenaza) Newsgroups: es.comp.os.linux.programacion Subject: Re: bash y passwd Date: Sat, 18 Jan 2003 17:26:50 +0100 Organization: Mondragon Unibertsitatea - ETEO Lines: 44 Distribution: es Message-ID: <87k7h2e851.fsf@barad-dur.escomposlinux.org> References: <2conf-lb2.ln1@paldaria.dsland.org> <b0bkkt$m62$1@titan.bt.es> <20030118145909.6d0ac8e3.444398@celes.unizar.es> <b0bq1p$onm$1@titan.bt.es> NNTP-Posting-Host: 22.red-80-38-245.pooles.rima-tde.net Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: poseidon.eteo.muni.es 1042907211 925 80.38.245.22 (18 Jan 2003 16:26:51 GMT) X-Complaints-To: newsmaster@eteo.mondragon.edu NNTP-Posting-Date: Sat, 18 Jan 2003 16:26:51 +0000 (UTC) User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/20.7 (i386-debian-linux-gnu) Cancel-Lock: sha1:t3axG5guI4e7vnljczwoo6W6zyE=