From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1817 invoked by alias); 22 Nov 2016 18:47:54 -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: 22124 Received: (qmail 9195 invoked from network); 22 Nov 2016 18:47:54 -0000 X-Qmail-Scanner-Diagnostics: from 195.159.176.226 by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(195.159.176.226):SA:0(1.3/5.0):. Processed in 1.640677 secs); 22 Nov 2016 18:47:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: gcszu-zsh-users@m.gmane.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at m.gmane.org does not designate permitted sender hosts) X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Yuri D'Elia Subject: Alias command /and/ flags Date: Tue, 22 Nov 2016 19:31:59 +0100 Message-ID: <878tsbfjs0.fsf@wavexx.thregr.org> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cancel-Lock: sha1:WeH1ItiEj9yOr6mq8CoOUKSC5Ww= Let's imagine I want to alias the specific invocation of "cmd flag" with "cmd2 flag2". Is it possible to alias commands with arguments (that is, only in command position and *not* global replacements)? I'm of course looking for an *exact* match of the positional parameters, no more. I can think of a way by defining a "cmd" function and do the checking on the arguments myself, which is definitely more generalizable, although seems a bit overkill for a simple scenario I had in mind. Any reason: alias "cmd flag"="cmd2 flag2" shouldn't work at least in principle?