How can I use aliased commands with xargs?

Posted by Nathan Fellman on Stack Overflow See other posts from Stack Overflow or by Nathan Fellman
Published on 2009-06-11T05:23:45Z Indexed on 2010/03/08 12:06 UTC
Read the original article Hit count: 418

Filed under:
|
|

I have the following alias in my .aliases:

alias gi grep -i

and I want to look for foo case-insensitively in all the files that have the string bar in their name:

find -name \*bar\* | xargs gi foo

This is what I get:

xargs: gi: No such file or directory

Is there any way to use aliases in xargs, or do I have to use the full version:

   find -name \*bar\* | xargs grep -i foo

Note: This is a simple example. Besides gi I have some pretty complicated aliases that I can't expand manually so easily.

Edit: I used tcsh, so please specify if an answer is shell-specific.

© Stack Overflow or respective owner

Related posts about xargs

Related posts about linux