Article View: es.comp.os.linux.programacion
Article #10319Re: como puedo poner ${$#}... (bash scripting)
From: J.A. Gutierrez
Date: Thu, 07 Mar 2002 12:54
Date: Thu, 07 Mar 2002 12:54
26 lines
1792 bytes
1792 bytes
dgfmdrv <dgfmdrvSPAM@terra.com> wrote: : De esta manera si que muestra el primer $1. Si lo pones en un bucle asi: : n=$# : while [ $1 ]; do : eval a=\$$n : echo $a $n : shift : n=`expr $n - 1` : done bueno, es logico: si haces un shift, lo que haces es que lo que antes era $2 ahora sea $1, lo que antes $3, ahora $2, etc etc; con lo que $# (o $n) siempre va a ser el ultimo argumento. quita el shift y cambia el [ $1 por [ $n -ne 0 -- PGP and other useless info at \ http://www.cps.unizar.es/~spd/ \ finger://daphne.cps.unizar.es/spd \ Timeo Danaos et dona ferentes ftp://ivo.cps.unizar.es/pub/ \ (Virgilio)
Technical Details
Message-ID:
<a67nv0$laq$1@news.unizar.es>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.rediris.es!news.unizar.es!not-for-mailReferences:
<6XYg8.21115$mz1.323523@telenews.teleline.es> <74eb6167.0203052336.7419a022@posting.google.com> <kLzh8.13075$Uh7.308837@telenews.teleline.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit
X-Google-Thread: f86c8,d3a204f5a4d4aebb
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-03-07 04:31:47 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.rediris.es!news.unizar.es!not-for-mail
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: como puedo poner ${$#}... (bash scripting)
Date: 7 Mar 2002 12:54:56 GMT
Organization: Rank
Lines: 26
Message-ID: <a67nv0$laq$1@news.unizar.es>
References: <6XYg8.21115$mz1.323523@telenews.teleline.es> <74eb6167.0203052336.7419a022@posting.google.com> <kLzh8.13075$Uh7.308837@telenews.teleline.es>
NNTP-Posting-Host: daphne.cps.unizar.es
X-Trace: news.unizar.es 1015505696 21850 155.210.152.20 (7 Mar 2002 12:54:56 GMT)
X-Complaints-To: usenet@news.unizar.es
NNTP-Posting-Date: 7 Mar 2002 12:54:56 GMT
User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (IRIX/6.2 (IP22))