From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14014 invoked by alias); 3 Dec 2013 22:44:39 -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: 18189 Received: (qmail 19795 invoked from network); 3 Dec 2013 22:44:33 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version:content-type :content-transfer-encoding; bh=8bq6bSZkh3rDel2pYCqCDr/3G+6Dfe9a4kUXjvGuAV4=; b=tdt7NfVaTPniR393mYzxJlk0r4gc0jDpagwMBtuOX5c7EN+2075FE5keSZq4Gnn9GT Qv3EAgti7aajZ0dFdEhJR6U78hrxI9tfevY0EJkopVgsFF1AbOq6b6KmRYkAfNpjDDJ9 5QGNnNPZD7W1jUDG7D4muZqDvYbPo7CS88Cr7JxJmCWkSmkRcwCjPTvYqkPNp2DfihYt stHslk+dcPDivowdfccqGOX5QG5CPOKpU1zTxF67zEndXZXW8HwM5buCcpclaio+EZuZ kYhwbSV4y5M2wOD7D1ZkWM+5mk9Mrf18pwmI7kHKatFchj2RJA+qMjRTNUFj20drAfaH 3IcA== X-Received: by 10.182.44.167 with SMTP id f7mr61273592obm.3.1386110668908; Tue, 03 Dec 2013 14:44:28 -0800 (PST) Date: Tue, 3 Dec 2013 17:44:18 -0500 From: TJ Luoma Subject: Processing Arguments To: Zsh-Users List X-Priority: 3 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailer: Mailsmith 2.3.1 (422) I'm sure there has to be a better way of doing this, but the way that I've = done it has always worked for me, so I've never bothered to look further. Here's what I do: ANOTHER=3Dno SOMETHING=3Dno=20 for ARGS in "$@" do=20 case "$ARGS" in=20 -s|--something) SOMETHING=3Dyes shift ;; -a|--another) ANOTHER=3Dyes shift ;; -*|--*) echo " $NAME [warning]: Don't know what to do with arg= : $1" shift ;; esac done # for args=20 The only downside to this is that you can't combine arguments such as `-sa`= you have to use `-s -a` Am I right? Is there a better way? TjL ps - I'm not _overly_ concerned with "portability" to other shells. I write= zsh scripts because I like what zsh has to offer.