Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

1 Answer 1

up vote 4 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.