Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Dec 2009 19:48:40 -0800
From:      George Davidovich <freebsd@optimis.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: Adding an alias to .cshrc
Message-ID:  <20091230034840.GA82978@marvin.optimis.net>
In-Reply-To: <4B3AA3CD.3020709@ibctech.ca>
References:  <4B3AA3CD.3020709@ibctech.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091230034840.GA82978>