I would have assumed that following examples work perfectly fine.
$ which -a python python3 pip | xargs -I {} {} --version
No '{}' such file or folder
$ which -a python python3 pip | xargs -I _ _ --version
No '_' such file or folder
$ which -a python python3 pip | xargs -I py py --version
No 'py' such file or folder
But they don't work at all when I run it interactively it doesn't even substitute the string. I see no note in manual page regarding a special case in first position. Why does this not work?
$ which -a python python3 pip | xargs -I py -p eval py --version
eval ~/.pyenv/shims/python --version?...y
xargs: eval: No such file or directory
This is even more surprising because it does substitute correctly.
How can I use the argument in first place? I don't want to use ... -I py sh -c "py --version"
because this will create a new sub-process. I wish to know how to eval command in current env.
which -a python python3 | map -1 % --version
(I don't have pip)