Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I'm using shell function like zip0 () { zip -0rq "$1" "$1"; }

And I wanted to use it with xargs like this.

$ seq 1 3 | xargs zip0
xargs: zip0: No such file or directory

But as the error message shows, it doesn't recognized as a command. How can I use xargs with shell function?

share|improve this question
up vote 1 down vote accepted

You'll have to have xargs invoke the shell:

seq 1 3 | xargs sh -c "zip0 () { zip -0rq "$1" "$1"; }; zip0"
share|improve this answer
If it is so complex to use shell function with xargs, I'd write shell script for it. Thanks anyway! – ironsand Sep 15 '13 at 1:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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