🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Script para borrar texto

#16320
From: J.A. Gutierrez
Date: Thu, 27 Apr 2000 00:00
51 lines
2244 bytes
Esteban <scandisk@ctv.es> wrote:

: #!/bin/sh

: echo "Teclea la direcci�n que quieres buscar"
: echo "Direcci�n:"
: read a
: grep $a /home/scandisk/Mail/visitas > /tmp/buscar1

	mal!
	generacion de ficheros en /tmp con nombre fijo/previsible =
	problemas de seguridad
	En general, ademas, conviene evitar los temporales

: grep -c $a /home/scandisk/Mail/visitas > /tmp/buscar2

	dos greps de lo mismo?
	muy poco eficiente

: cat /tmp/buscar1
: c=`cat /tmp/buscar2`
: echo "Se han encontrado $c coincidencias"


#!/bin/sh


while :
do
	echo "Teclea la direcci�n que quieres buscar"
	echo -n "Direcci�n: "
	read a
	c=`fgrep "$a" /home/scandisk/Mail/visitas | tee /dev/tty | wc -l`
	echo "Se han encontrado $c coincidencias"
	echo -n "Continue? [y/N] "
	read ans
	if [ "$ans" != "y" ]
	then
		exit 0
    fi
done

: ha encontrado y mostrarlas, me gustar�a que me preguntara si quiero volver a
: consultar y como hacer que distinga Si de No. Pongo a lo bruto lo que quiero:


-- 
PGP and other useless info at      \                 Oh, show us the way
http://www.cps.unizar.es/~spd/      \             to the next whisky bar
finger://daphne.cps.unizar.es/spd    \                      Weill/Bretch
es doloroso ser sabio y descubrir la sopa de ajo                   (Pla)
Technical Details
Message-ID: <8e9nk6$o86$1@news.unizar.es>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <slrn8gc3gr.1uq.scandisk@localhost.localdomain> <3906A0DF.F1BBE9A7@NOSPAM.inicia.es> <slrn8gduht.kc.scandisk@localhost.localdomain> <39070101.30EF1934@NOSPAM.inicia.es> <slrn8ge5j5.1e6.scandisk@localhost.localdomain>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,99dd52c8b846d8df
X-Google-Attributes: gidf86c8,public
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Subject: Re: Script para borrar texto
Date: 2000/04/27
Message-ID: <8e9nk6$o86$1@news.unizar.es>
X-Deja-AN: 616391157
Content-Transfer-Encoding: 8bit
References: <slrn8gc3gr.1uq.scandisk@localhost.localdomain> <3906A0DF.F1BBE9A7@NOSPAM.inicia.es> <slrn8gduht.kc.scandisk@localhost.localdomain> <39070101.30EF1934@NOSPAM.inicia.es> <slrn8ge5j5.1e6.scandisk@localhost.localdomain>
Content-Type: text/plain; charset=ISO-8859-1
X-Complaints-To: usenet@news.unizar.es
X-Trace: news.unizar.es 956850630 24838 155.210.152.20 (27 Apr 2000 15:50:30 GMT)
Organization: Rank
Mime-Version: 1.0
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (IRIX/6.2 (IP22))
NNTP-Posting-Date: 27 Apr 2000 15:50:30 GMT
Newsgroups: es.comp.os.linux.programacion