🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: bash: ambito de variables con while

#9152
From: NotFound
Date: Thu, 29 Aug 2002 17:06
17 lines
1284 bytes
jG-PPz escribió:

> Por qué el ambito de una variable en bash dentro de un while se
> acaba al salir de éste?
> 
> ---SCRIPT: prueba.sh ---
> #!/bin/bash
> while read variable
> do
>    echo "valor: $variable"
> done

No es que la variable salga de ambito, es que el ultimo read, el que
devuelve false y termina el while, la deja en blanco.

Salu2
Technical Details
Message-ID: <3D6E547F.9C3B3CC3@tengo.no>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!cesio.mundo-r.com!not-for-mail
References: <lnclka.5q3.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 11:01:55 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer00.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 19:06:07 +0200
Organization: Another Netscape Collabra Server User
Lines: 17
Message-ID: <3D6E547F.9C3B3CC3@tengo.no>
References: <lnclka.5q3.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