Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

up vote 6 down vote accepted

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; }
share|improve this answer

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