Search code examples
bashshellterminalpipelinexargs

Pipe to export command


Why does export fail when used as the last step in a command pipeline?

echo FOO=bar | xargs export
# => xargs: export: No such file or directory

I can rewrite it this way to accomplish what I want:

export `echo FOO=bar`

But why can't I use export in the first way?


Solution

  • export is a shell builtin and xargs expects an actual binary.