🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

�Bash y el �mbito de las variables?

#12859
From: David Cana
Date: Tue, 08 May 2001 15:09
42 lines
1880 bytes
Buenas.

Este trozo de script lee de un fichero una lista de ficheros que hay que
copiar posteriormente:

------------
(
while read LINEA
        do
                LISTA_DIRS="$LISTA_DIRS .$LINEA"
                MENSAJE="Agregando $LINEA a la lista de directorios a
copiar...
                echo $MENSAJE
        done
) < $RUTA_FICHERO_CONF_BACKUP

MENSAJE="La lista definitiva de directorios a copiar es $LISTA_DIRS"
echo $MENSAJE
----------

Pues bien, no funciona. La variable LISTA_DIRS esta vac�a al final del
script. Parece como si nos hubi�ramos salido del �mbito de la variable. �sto
s� funciona:

------------
(
while read LINEA
        do
                LISTA_DIRS="$LISTA_DIRS .$LINEA"
                MENSAJE="Agregando $LINEA a la lista de directorios a
copiar...
                echo $MENSAJE
        done

        MENSAJE="La lista definitiva de directorios a copiar es $LISTA_DIRS"
        echo $MENSAJE
) < $RUTA_FICHERO_CONF_BACKUP
----------

�Alg�n alma caritativa me lo puede explicar?

Gracias.
Technical Details
Message-ID: <9d91qq$8al$1@diana.bcn.ttd.net>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.174.75.178!news-fra1.dfn.de!fu-berlin.de!newsfeed.bcn.ttd.net!news.bcn.ttd.net!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,172d2a91d5047ff8,start
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-05-08 08:09:02 PST
Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.174.75.178!news-fra1.dfn.de!fu-berlin.de!newsfeed.bcn.ttd.net!news.bcn.ttd.net!not-for-mail
From: "David Cana" <davidNO_SPAM@cherrytel.com>
Newsgroups: es.comp.os.linux.programacion
Subject: �Bash y el �mbito de las variables?
Date: Tue, 8 May 2001 17:09:05 +0200
Organization: Telefonica Transmision de Datos
Lines: 45
Message-ID: <9d91qq$8al$1@diana.bcn.ttd.net>
NNTP-Posting-Host: rage.cherrytel.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200