在研究另一个问题时,我遇到了一个命令,
locate something | xargs -I {} bash -c "if [ -d "{}" ]; then echo {}; fi"
Run Code Online (Sandbox Code Playgroud)
我想了解更多。所以我运行man xargs
并得到以下输出:
XARGS(1) General Commands Manual XARGS(1)
NAME
xargs - build and execute command lines from standard input
SYNOPSIS
xargs [-0prtx] [-E eof-str] [-e[eof-str]] [--eof[=eof-str]] [--null]
[-d delimiter] [--delimiter delimiter] [-I replace-str] [-i[replace-
str]] [--replace[=replace-str]] [-l[max-lines]] [-L max-lines]
[--max-lines[=max-lines]] [-n max-args] [--max-args=max-args] [-s max-
chars] [--max-chars=max-chars] [-P max-procs] [--max-procs=max-procs]
[--interactive] [--verbose] [--exit] [--no-run-if-empty]
[--arg-file=file] [--show-limits] [--version] [--help] [command …
Run Code Online (Sandbox Code Playgroud) man ×1