showkey
showkey

Reputation: 298

why `echo "//" | xargs -0` result in newline?

test@hwy:~$ echo "//" | xargs -0
// 

test@hwy:~$ 

Why there is a newline here?Why the result is not as below?

test@hwy:~$ echo "//" | xargs -0
// 
test@hwy:~$ 

Man xargs can't tell me reason.

   -0     Input  items  are  terminated  by a null character instead of by
          whitespace, and the quotes and backslash are not special  (every
          character is taken literally).  Disables the end of file string,
          which is treated like any other  argument. 

Upvotes: 1

Views: 241

Answers (1)

Paul Stelian
Paul Stelian

Reputation: 1379

echo prints a newline and xargs is told to not consider a special character.

You may get the wanted effect by using the -n parameter to echo.

Upvotes: 1

Related Questions