From owner-freebsd-questions@FreeBSD.ORG Wed Dec 30 03:48:41 2009 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 4D0AF1065693 for ; Wed, 30 Dec 2009 03:48:41 +0000 (UTC) (envelope-from freebsd@optimis.net) Received: from mail.optimis.net (mail.optimis.net [69.104.191.124]) by mx1.freebsd.org (Postfix) with ESMTP id 20C028FC18 for ; Wed, 30 Dec 2009 03:48:40 +0000 (UTC) Received: from marvin.optimis.net (marvin.optimis.net [192.168.1.3]) by mail.optimis.net (8.14.3/8.14.2) with ESMTP id nBU3meKU037893; Tue, 29 Dec 2009 19:48:40 -0800 (PST) (envelope-from freebsd@optimis.net) Received: from marvin.optimis.net (localhost [127.0.0.1]) by marvin.optimis.net (8.14.3/8.14.3) with ESMTP id nBU3meCc083243; Tue, 29 Dec 2009 19:48:40 -0800 (PST) (envelope-from freebsd@optimis.net) Received: (from george@localhost) by marvin.optimis.net (8.14.3/8.14.3/Submit) id nBU3mect083242; Tue, 29 Dec 2009 19:48:40 -0800 (PST) (envelope-from freebsd@optimis.net) Date: Tue, 29 Dec 2009 19:48:40 -0800 From: George Davidovich To: freebsd-questions@freebsd.org Message-ID: <20091230034840.GA82978@marvin.optimis.net> References: <4B3AA3CD.3020709@ibctech.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B3AA3CD.3020709@ibctech.ca> User-Agent: Mutt/1.5.19 (2009-01-05) Subject: Re: Adding an alias to .cshrc X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2009 03:48:41 -0000 On Tue, Dec 29, 2009 at 07:50:21PM -0500, Steve Bertrand wrote: > I want to add an alias to my .cshrc file: > > alias srm find . -name "*~" | xargs rm No need for xargs: alias srm "find . -name '*~' -exec rm {} +" or alias srm "find . -name '*~' -delete" > ...so that I have an easy way to remove the temp files left by svn. > > After adding the alias, logging out and then back in, I get an error > stating: Use the builtin(1) 'source' command. No need to log out/log in. > acct-dev: ISP-RADIUS % srm > srm: Command not found. I'm sure someone more knowledgable about csh (I rely on bash) can help you debug what exactly happens and why, but quoting your alias command in .cshrc is all that's required. > I thought that perhaps the file wasn't being read upon login, so I > appended a new alias underneath: Easier to check your aliases by typing 'alias', no? > alias srm find . -name "*~" | xargs rm > alias sll ls -lA > > ...which works fine when called after re-login. > > I even went as far as to prefix the find/xargs command with full paths, > to no avail. > > Is this a problem with the pipe in the alias directive? The command > works on the CLI, as I literally copy/pasted it into the .cshrc file. Again, quoting what's being aliased will suffice. Why that's not necessary during interactive use, I don't know, but I'd get into the habit of quoting such things regardless. -- George