From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24197 invoked by alias); 8 Jul 2014 13:10:37 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18934 Received: (qmail 8208 invoked from network); 8 Jul 2014 13:10:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_NUMERIC_HELO,SPF_HELO_PASS,T_FSL_HELO_BARE_IP_2 autolearn=no version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: zzapper Subject: Re: how do I get the last argument from a list of arguments? Date: Tue, 8 Jul 2014 12:52:00 +0000 (UTC) Organization: Your Company Message-ID: References: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 2.25.230.74 User-Agent: Xnews/2009.05.01 X-Antivirus: avast! (VPS 140708-0, 07/08/2014), Outbound message X-Antivirus-Status: Clean TJ Luoma wrote in news:CADjGqHuALx7Ue3Ei3s7XvT_pHWxECo2rt=3DBNegPO5Fwcuge2LQ@mail.gmail.com: = > I=E2=80=99m trying to learn better ways of dealing with arguments given t= o a > function, because I am sure that I am not doing it the most efficient > way. Similar to Kurtis p() { echo "last ${@[-1]}" echo "2nd last ${@[-2]}" } p a b c d -- zzapper https://twitter.com/dailyzshtip --- This email is free from viruses and malware because avast! Antivirus protec= tion is active. http://www.avast.com