๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: bash: ambito de variables con while

#9155
From: NotFound
Date: Thu, 29 Aug 2002 21:24
32 lines
1596 bytes
> ---script.sh---
> cat datos.txt | while read FIELD VALUE

while read FIELD VALUE

> do
>    case $FIELD in
>       nombre)
>          nombre=$VALUE
>          ;;
>       email)
>          email=$VALUE
>          ;;
>    esac
> done

done < datos.txt

> 
> #ahora aqui no me saca los valores que habia cogido... ยฟ?
> echo $nombre
> echo $email
> ---
> 
> Esto es lo que pretendo.
> Y si no se puede hacer de esta forma, cรณmo se puede entonces?

Haz esos cambios que te he puesto.

Salu2
Technical Details
Message-ID: <3D6E910B.7716D1EE@tengo.no>
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.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!lnewspeer00.lnd.ops.eu.uu.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!cesio.mundo-r.com!not-for-mail
References: <lnclka.5q3.ln@192.168.0.102> <j5tlka.go5.ln@192.168.0.102>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,b26f7a7eb5428370
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-08-29 14:58:12 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.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!lnewspeer00.lnd.ops.eu.uu.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!cesio.mundo-r.com!not-for-mail
From: NotFound <correo@tengo.no>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: bash: ambito de variables con while
Date: Thu, 29 Aug 2002 23:24:27 +0200
Organization: Another Netscape Collabra Server User
Lines: 32
Message-ID: <3D6E910B.7716D1EE@tengo.no>
References: <lnclka.5q3.ln@192.168.0.102> <j5tlka.go5.ln@192.168.0.102>
NNTP-Posting-Host: cm65010.red.mundo-r.com
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Mailer: Mozilla 4.77 [es] (X11; U; Linux 2.4.4-4GB i686)
X-Accept-Language: en