4

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?

gaitat
  • 12,449
  • 4
  • 52
  • 76

1 Answers1

2

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
}
Etan Reisner
  • 77,877
  • 8
  • 106
  • 148