Article View: es.comp.os.linux.programacion
Article #5898Re: Bash: elementos de una colección.
From: Fernando Arbeiza
Date: Sun, 31 Aug 2003 10:03
Date: Sun, 31 Aug 2003 10:03
30 lines
1737 bytes
1737 bytes
Hola:
Bueno, se puede hacer as�, pero casi mejor que utilices una variable
global y la asignes en objetivos(). Ah� va:
#########################
#!/bin/bash
objetivos()
{
for I in "${@}"; do
echo "\"${I}\""
done
}
eval "COLECCION=($(objetivos '${@}'))"
echo "Tama�o de la colecci�n: ${#COLECCION[@]}"
echo "---"
echo "Elemento 1: ${COLECCION[0]}"
echo "Elemento 2: ${COLECCION[1]}"
echo "---"
# Fin de Fichero
#########################
Un saludo.
--
Fernando Arbeiza <URL: mailto:arbeizaf@ono.com>
Crea tu propio Linux: <URL: http://www.escomposlinux.org/lfs-es>
Technical Details
Message-ID:
<slrnbl3hv6.ai.arbeizaf@jupiter.olimpo.homelinux.org>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!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!81-203-248-186.user.ono.COM!not-for-mailReferences:
<birhdv$c8okj$1@ID-130393.news.uni-berlin.de> <birmfr$ce663$1@ID-130393.news.uni-berlin.de>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,fb6dad6ad0f7d3c4 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2003-08-31 03:16:13 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!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!81-203-248-186.user.ono.COM!not-for-mail From: Fernando Arbeiza <arbeizaf@ono.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: Bash: elementos de una colección. Date: Sun, 31 Aug 2003 12:03:19 +0200 Lines: 30 Message-ID: <slrnbl3hv6.ai.arbeizaf@jupiter.olimpo.homelinux.org> References: <birhdv$c8okj$1@ID-130393.news.uni-berlin.de> <birmfr$ce663$1@ID-130393.news.uni-berlin.de> NNTP-Posting-Host: 81-203-248-186.user.ono.com (81.203.248.186) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 1062324972 13310307 81.203.248.186 (16 [148301]) X-Orig-Path: jupiter.olimpo.homelinux.org!news User-Agent: slrn/0.9.7.4 (Linux)