Aliases in .bashrc and .tcshrc

Aliases in .bashrc and .tcshrc

Post by Alex Vinoku » Wed, 18 Apr 2001 17:07:15



-----------------------------------------------
#uname -a
Linux gcc 2.2.17-21mdk #1 Thu Oct 5 13:16:08 CEST 2000 i586 unknown
-----------------------------------------------

I defined the following alias in .tcshrc
alias fnd       'find . -name \!* -print'
It works, for instance :
fnd abcd.

I tried to define following aliases in .bashrc
alias fnd1='find . -name !* -print'
alias fnd2='find . -name \!* -print'

It doen't work :

find: paths must precede expression
Usage: find [path...] [expression]


find: paths must precede expression
Usage: find [path...] [expression]

What is wrong?
How to define in .bashrc alias fnd identical the same alias in .tcshrc?

Thanks in advance,

============================
Alex Vinokur

   http://go.to/alexv_math
============================

 
 
 

Aliases in .bashrc and .tcshrc

Post by Alex Vinoku » Wed, 18 Apr 2001 17:53:30



> -----------------------------------------------
> #uname -a
> Linux gcc 2.2.17-21mdk #1 Thu Oct 5 13:16:08 CEST 2000 i586 unknown
> -----------------------------------------------

> I defined the following alias in .tcshrc
> alias fnd       'find . -name \!* -print'
> It works, for instance :
> fnd abcd.

> I tried to define following aliases in .bashrc
> alias fnd1='find . -name !* -print'
> alias fnd2='find . -name \!* -print'

> It doen't work :

> find: paths must precede expression
> Usage: find [path...] [expression]


> find: paths must precede expression
> Usage: find [path...] [expression]

> What is wrong?
> How to define in .bashrc alias fnd identical the same alias in .tcshrc?

We can do it in .bashrc using function :

function fnd
{
   find / -name "$1" -print

Quote:}

It works OK.

Can we do it using alias?

- Show quoted text -

> Thanks in advance,

> ============================
> Alex Vinokur

>    http://go.to/alexv_math
> ============================


 
 
 

Aliases in .bashrc and .tcshrc

Post by Mike Delan » Fri, 20 Apr 2001 06:40:42




:
:
:
: > -----------------------------------------------
: > #uname -a
: > Linux gcc 2.2.17-21mdk #1 Thu Oct 5 13:16:08 CEST 2000 i586 unknown
: > -----------------------------------------------
: >
: > I defined the following alias in .tcshrc
: > alias fnd       'find . -name \!* -print'
: > It works, for instance :
: > fnd abcd.
: >
: > I tried to define following aliases in .bashrc
: > alias fnd1='find . -name !* -print'
: > alias fnd2='find . -name \!* -print'
: >
: > It doen't work :

: > find: paths must precede expression
: > Usage: find [path...] [expression]
: >

: > find: paths must precede expression
: > Usage: find [path...] [expression]
: >
: > What is wrong?
: > How to define in .bashrc alias fnd identical the same alias in .tcshrc?
:
: We can do it in .bashrc using function :
:
: function fnd
: {
:    find / -name "$1" -print
: }
: It works OK.
:
: Can we do it using alias?

No.  Aliases in bash (and ksh) can't take arguments.  The use of
a shell function as you've done above is the correct way to do
this.

That said, in this particular case, the -print argument to find(1)
is redundant, so you could do:

$ alias fnd='find . -name'
$ fnd abc

--

"...Microsoft follows standards.  In much the same manner that fish follow
migrating caribou." "Now I have this image in my mind of a fish embracing and
extending a caribou." -- Paul Tomblin and Christian Bauernfeind in the SDM

 
 
 

1. Aliases in .bashrc and .tcshrc

-----------------------------------------------
#uname -a
Linux gcc 2.2.17-21mdk #1 Thu Oct 5 13:16:08 CEST 2000 i586 unknown
-----------------------------------------------

I defined the following alias in .tcshrc
alias fnd       'find . -name \!* -print'
It works, for instance :
fnd abcd.

I tried to define following aliases in .bashrc
alias fnd1='find . -name !* -print'
alias fnd2='find . -name \!* -print'

It doen't work :

find: paths must precede expression
Usage: find [path...] [expression]


find: paths must precede expression
Usage: find [path...] [expression]

What is wrong?
How to define in .bashrc alias fnd identical the same alias in .tcshrc?

Thanks in advance,

============================
Alex Vinokur

   http://go.to/alexv_math
============================

2. Make Your Hotel Reservation Soon - Boston Conf!

3. curses question

4. Use of "alias" in .tcshrc Failing?

5. Linux und Canon BJC 4400

6. .bashrc aliases

7. Installing 3com 503c eth net card in SCO VER 1.1

8. using aliases in .bashrc

9. newbie: where is root's .bashrc to set aliases, ...

10. ssh login can't use aliases from .bashrc!

11. using aliases in .bashrc

12. .bashrc "alias" setting not working