Article View: es.comp.os.linux.programacion
Article #5894Re: Bash: elementos de una colección.
From: Pascal Bourguignon
Date: Sun, 31 Aug 2003 02:22
Date: Sun, 31 Aug 2003 02:22
59 lines
2491 bytes
2491 bytes
"J. P." <not_my@mail.com> writes:
> objetivos()
> {
> for I in "${@}"
> do
> echo "${I}"
> done
> }
>
> COLECCION=($(objetivos "${@}"))
�Qu� trata de hacer?
Por que no usar un mejor lenguaje, por ejemplo lisp:
-----------------------------(prueba)-----------------------------
#!/usr/bin/clisp -ansi
(defun objetivos (args)
args)
(defparameter coleccion (objetivos EXT:*ARGS*))
(format t "Tama�o de la colecci�n: ~D~%" (length coleccion))
(format t "---~%")
(format t "Elemento 1: ~A~%" (nth 0 coleccion))
(format t "Elemento 2: ~A~%" (nth 1 coleccion))
(format t "---~%")
;;;; prueba -- 2003-08-31 04:21:20 -- pascal ;;;;
-----------------------------(prueba)-----------------------------
[pascal@thalassa pascal]$ ./prueba ab "c\ d" ef
Tama�o de la colecci�n: 3
---
Elemento 1: ab
Elemento 2: c\ d
---
[pascal@thalassa pascal]$ ./prueba ab c\ d ef
Tama�o de la colecci�n: 3
---
Elemento 1: ab
Elemento 2: c d
---
[pascal@thalassa pascal]$ ./prueba ab cd ef
Tama�o de la colecci�n: 3
---
Elemento 1: ab
Elemento 2: cd
---
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
Do not adjust your mind, there is a fault in reality.
Technical Details
Message-ID:
<87wucuh8gr.fsf@thalassa.informatimago.com>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!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!thalassa.informatimago.COM!not-for-mailReferences:
<birhdv$c8okj$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-30 19:22:34 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!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!thalassa.informatimago.COM!not-for-mail From: Pascal Bourguignon <spam@thalassa.informatimago.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: Bash: elementos de una colección. Date: 31 Aug 2003 04:22:28 +0200 Organization: informatimago.com Lines: 59 Message-ID: <87wucuh8gr.fsf@thalassa.informatimago.com> References: <birhdv$c8okj$1@ID-130393.news.uni-berlin.de> NNTP-Posting-Host: thalassa.informatimago.com (195.114.85.198) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 1062296553 13259351 195.114.85.198 (16 [41911]) User-Agent: Gnus/5.09 (Gnus v5.9.0) 21.3.50.pjb1.1