stein
stein

Reputation: 58

xargs lines containing -e and -n processed differently

When running the following command with xargs (GNU findutils) 4.7.0

xargs -n1 <<<"-d -e -n -o"

I get this output

-d

-o

Why is -e and -n not present in the output?

Upvotes: 0

Views: 64

Answers (1)

KamilCuk
KamilCuk

Reputation: 141493

From man xargs:

[...] and executes the command (default is /bin/echo) [...]

So it runs:

echo -d
echo -e
echo -n
echo -o

But from man echo:

-n     do not output the trailing newline

-e     enable interpretation of backslash escapes

And echo -n outputs nothing, and echo -e outputs one empty newlines that you see in the output.

Upvotes: 2

Related Questions