You could do:
echo -a -b -c | xargs -n 1 command
Or:
xargs -n1 command <<< '-a -b -c'
with some shells.
But beware that it affects the stdin of command
.
With zsh
:
autoload zargs # best in ~/.zshrc
zargs -n 1 -- -a -b -c -- command
Or simply:
for o (-a -b -c) command $o
None of those would abort if any of the command
invocations failed (except if it fails with the 255 exit status).
For that, you'd want:
for o (-a -b -c) command $o || break
That still fails to the $?
to the exit status of the failed command
invocation). You could change that to:
(){for o (-a -b -c) command $o || return}
But by that time, it's already longer than:
command -a && command -b && command -c
cmd -a; cmd -b; cmd -c
in long run, as all human beings do. – jimmij 8 hours ago