gaitat
gaitat

Reputation: 12642

bash vs. tcsh alias argument passing

I used to have this alias in tcsh to find files on the filesystem.

alias findf 'find . -name \!* -print'

How do I write this in bash shell?

Upvotes: 4

Views: 285

Answers (1)

Etan Reisner
Etan Reisner

Reputation: 81012

That's a shell function and not an alias (assuming \!* is a placeholder for the alias "arguments").

To accept just a single argument:

findf() {
    find . -name "$1" -print
}

To accept any number of arguments (not that this is very useful for the argument to -name):

findf() {
    find . -name "$@" -print
}

Upvotes: 2

Related Questions