Possible Duplicate:
How to pass parameter to alias?

I am trying to shorten the find command, but getting an error:

$ alias f='find . -name $1 -print'
$ f JobConf.java

find: paths must precede expression: JobConf.java
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

How can I make this work?

marked as duplicate by Michael Mrozek Sep 29 '11 at 13:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Aliases are just simple replacements and don't work that way. You probably want a function, which do everything aliases can do and more.

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.