I need to use xargs to call a function in parallel in fish shell. I tried this:
#!/bin/fish
function func
echo $argv
end
echo 'example1' 'example2' | xargs -n1 func
But I got this:
xargs: func: No such file or directory
So, how can I make it work?
Using bash this worked:
#!/bin/bash
function func {
echo $1
}
export -f func
echo 'example1' 'example2' | xargs -n1 bash -c 'func $@' _