From owner-freebsd-chat Fri Jun 20 14:53:49 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id OAA27206 for chat-outgoing; Fri, 20 Jun 1997 14:53:49 -0700 (PDT) Received: from mexico.brainstorm.eu.org (root@mexico.brainstorm.fr [193.56.58.253]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id OAA27196 for ; Fri, 20 Jun 1997 14:53:43 -0700 (PDT) Received: from brasil.brainstorm.eu.org (brasil.brainstorm.fr [193.56.58.33]) by mexico.brainstorm.eu.org (8.8.4/8.8.4) with ESMTP id XAA22592 for ; Fri, 20 Jun 1997 23:53:35 +0200 Received: (from uucp@localhost) by brasil.brainstorm.eu.org (8.8.4/8.6.12) with UUCP id XAA24529 for freebsd-chat@FreeBSD.ORG; Fri, 20 Jun 1997 23:53:33 +0200 Received: (from roberto@localhost) by keltia.freenix.fr (8.8.6/keltia-uucp-2.9) id XAA20882; Fri, 20 Jun 1997 23:31:12 +0200 (CEST) Message-ID: <19970620233112.04222@keltia.freenix.fr> Date: Fri, 20 Jun 1997 23:31:12 +0200 From: Ollivier Robert To: freebsd-chat@FreeBSD.ORG Subject: Re: OS/2 users going to FreeBSD? :-) References: <199706191239.IAA14178@gatekeeper.itribe.net> <19970619215751.20461@keltia.freenix.fr> <19970620201858.04493@keltia.freenix.fr> <19970620161450.18176@right.PCS> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.76 In-Reply-To: <19970620161450.18176@right.PCS>; from Jonathan Lemon on Fri, Jun 20, 1997 at 04:14:51PM -0500 X-Operating-System: FreeBSD 3.0-CURRENT ctm#3392 AMD-K6 MMX @ 208 MHz Sender: owner-chat@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk According to Jonathan Lemon: > I use the alias features of tcsh heavily, especially the "!*" construct, and > don't want to give that up. Does zsh support command substitution in > aliasing? Yes. It supports many things from csh too... Extracted from the FAQ: 1. If the csh alias references "parameters" (\!:1 \!* etc.), then in zsh you need a function (referencing $1 $* etc.). Otherwise, you can use a zsh alias. 2. If you use a zsh function, you need to refer _at_least_ to $* in the body (inside the { }). Parameters don't magically appear inside the { } the way they get appended to an alias. 3. If the csh alias references its own name (alias rm "rm -i"), then in a zsh function you need the "command" keyword (function rm() { command rm -i $* }), but in a zsh alias you don't (alias rm="rm -i"). 4. If you have aliases that refer to each other (alias ls "ls -C"; alias lf "ls -F" ==> lf == ls -C -F) then you must either: a. convert all of them to zsh functions; or b. after converting, be sure your .zshrc defines all of your aliases before it defines any of your functions. Those first four are all you really need, but here are four more for heavy csh alias junkies: 5. Mapping from csh alias "parameter referencing" into zsh function (assuming shwordsplit and ksharrays are NOT set in zsh): csh zsh ===== ========== \!* $* (or $argv) \!^ $1 (or $argv[1]) \!:1 $1 \!:2 $2 (or $argv[2], etc.) \!$ $*[$#] (or $argv[$#], or $*[-1]) \!:1-4 $*[1,4] \!:1- $*[1,$#-1] (or $*[1,-2]) \!^- $*[1,$#-1] \!*:q "$@" ($*:q doesn't work (yet)) \!*:x $=* ($*:x doesn't work (yet)) I've sent a bug report for %{...%}. We'll see. -- Ollivier ROBERT -=- FreeBSD: There are no limits -=- roberto@keltia.freenix.fr FreeBSD keltia.freenix.fr 3.0-CURRENT #20: Fri Jun 13 00:16:13 CEST 1997