why can't I use $1 in .cshrc ?

Derek Ragona derek at computinginnovations.com
Thu Jun 26 12:39:52 UTC 2008

At 07:04 AM 6/26/2008, 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 ?

I think you are trying to use an alias where it won't really work.  A 
typical alias is:
la  for ls -a
ll  for ls -lA

It looks like you want to pass an argument and a filename, or at least an 
argument to grep.  Not quite sure if that would work or if it would be much 

The $ is a special character that is interpreted and expanded by the 
shell.  You can use it by escaping it or putting it in quotes, but that 
depends on where it is used (in .cshrc, in a script, etc.)


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the freebsd-questions mailing list