Using zsh functions with xargs
I want to call a zsh function with xargs
, but the arguments passed to xargs
don't run in your environment.
No such file or directory!? hi
is a function, but xargs
doesn't see it. With a combination of environment variables, function output and zsh command execution, we can use that function with xargs.
First let's read the definition of our function into an environment variable.
Now we can use that in combination with zsh -c
to execute the function with xargs.
This solution is messy but workable.
Tweet