Assume that the command alpha
produces this output:
a b c
d
If I run the command
beta $(alpha)
then beta
will be executed with four parameters, "a"
, "b"
, "c"
and "d"
.
But if I run the command
beta "$(alpha)"
then beta
will be executed with one parameter, "a b c d"
.
What should I write in order to execute beta
with two parameters, "a b c"
and "d"
. That is, how do I force $(alpha)
to return one parameter per output line from alpha
?
You can use:
$ alpha | xargs -d "\n" beta
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With