I am trying to give an input to xargs that is NUL separated. To this effect I have this:
$ echo -n abc$'\000'def$'\000' | xargs -0 -L 1
I get
abcdef
I wonder why doesn't it print o/p as
abc
def
あなたの主な問題はあなたが忘れたことです-e:
$ echo -n abc$'\000'def$'\000' |cat -v
abcdef
ゼロバイトは表示されません。でも、これ:
$ echo -en abc'\000'def'\000' |cat -v
abc^@def^@
それに似ていますが、これはゼロバイトを表示する^@方法です。cat -vそして今のためにxargs:
$ echo -en abc'\000'def'\000' | xargs -0 -L 1
abc
def
help echobashプロンプトから試してください。
入力を一重引用符で囲まれた文字列として扱ってみてください。
echo -ne "abc\0def\0" | xargs -0 -L 1