From owner-freebsd-questions@FreeBSD.ORG Thu Jun 26 15:10:13 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CB79106564A for ; Thu, 26 Jun 2008 15:10:13 +0000 (UTC) (envelope-from raghu@mri.ernet.in) Received: from hrimail.hri.res.in (hrimail.hri.res.in [210.212.50.7]) by mx1.freebsd.org (Postfix) with ESMTP id D4FE38FC21 for ; Thu, 26 Jun 2008 15:10:11 +0000 (UTC) (envelope-from raghu@mri.ernet.in) Received: from ipc2.mri.ernet.in (unknown [192.168.3.2]) by hrimail.hri.res.in (Postfix) with ESMTP id 6ADD697E56; Thu, 26 Jun 2008 20:46:55 +0530 (IST) Received: from ipc2 (localhost [127.0.0.1]) by ipc2 (Postfix) with SMTP id 16B031CA72; Thu, 26 Jun 2008 20:40:01 +0530 (IST) Received: from riemann.mri.ernet.in (riemann.mri.ernet.in [192.168.3.122]) by ipc2.mri.ernet.in (Postfix) with ESMTP id E7D9714C91; Thu, 26 Jun 2008 20:40:00 +0530 (IST) Received: from riemann.mri.ernet.in (localhost [127.0.0.1]) by riemann.mri.ernet.in (8.13.6/8.13.6) with ESMTP id m5QF5Z8q085086; Thu, 26 Jun 2008 20:35:35 +0530 (IST) (envelope-from raghu@riemann.mri.ernet.in) Received: (from raghu@localhost) by riemann.mri.ernet.in (8.13.6/8.13.6/Submit) id m5QF5Lob085085; Thu, 26 Jun 2008 20:35:21 +0530 (IST) (envelope-from raghu) From: "N. Raghavendra" To: juri_mian@yahoo.com In-Reply-To: <510944.89845.qm@web45604.mail.sp1.yahoo.com> (Juri Mianovich's message of "Thu, 26 Jun 2008 05:04:52 -0700 (PDT)") References: <510944.89845.qm@web45604.mail.sp1.yahoo.com> X-Organization: Harish-Chandra Research Institute (HRI) X-Address: Chhatnag Road, Jhusi, Allahabad 211 019, India X-URL: http://www.mri.ernet.in/ and http://www.retrotexts.net/ X-Phone: +91 (532) 2667 509, 2667 318, 2667 578, 2567 746, 2567 747 X-Fax: +91 (532) 2667 576, 2567 748, 2567 444, 2568 036 X-OpenPGP-Key-ID: 0x03618806 X-OpenPGP-Key-Fingerprint: C75D D0AF 457E 7454 BEC2 37AD C6E1 0407 0361 8806 X-OpenPGP-Public-Key-Available-At: http://www.keyserver.net/ Date: Thu, 26 Jun 2008 20:35:21 +0530 Message-ID: <867iccp77y.fsf@riemann.mri.ernet.in> User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-questions@freebsd.org Subject: Re: why can't I use $1 in .cshrc ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "N. Raghavendra" List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jun 2008 15:10:13 -0000 At 2008-06-26T05:04:52-07:00, Juri Mianovich wrote: > I am trying to use this alias in my root .cshrc file: > > grep $1 /some/file > > but .cshrc _refuses_ to expand $1 as a proper variable (in this > case, the first argument to the alias...) > > I _think_ it's because $1 is being interpreted as a argument to csh > _itself_ when it runs .cshrc ... but maybe I'm wrong. > > Anyway, how to make it work ? See the tcsh(1) section `Alias substitution': "If the alias contains a history reference, it undergoes History substitution (q.v.) as though the original command were the previous input line." [riemann:/home/raghu]% alias foo "grep \!^ /etc/passwd" [riemann:/home/raghu]% foo toor toor:*:0:0:Bourne-again Superuser:/root: [riemann:/home/raghu]% alias bar "grep \!:1 \!:2" [riemann:/home/raghu]% bar '^man' /etc/passwd man:*:9:9:Mister Man Pages:/usr/share/man:/usr/sbin/nologin HTH, Raghavendra. -- N. Raghavendra | http://www.retrotexts.net/ Harish-Chandra Research Institute | http://www.mri.ernet.in/ See message headers for contact and OpenPGP information.