When to use xargs when piping?

后端 未结 5 539
挽巷
挽巷 2021-02-07 10:59

I am new to bash and I am trying to understand the use of xargs, which is still not clear for me. For example:

history | grep ls

H

5条回答
  •  离开以前
    2021-02-07 11:52

    xargs(1) is dangerous (broken, exploitable, etc.) when reading non-NUL-delimited input.

    If you're working with filenames, use find's -exec [command] {} + instead. If you can get NUL-delimited output, use xargs -0.

提交回复
热议问题