aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-11-17 00:01:08 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-11-17 00:01:08 +0100
commitdeb4619a79deace26923e91a93b6d7bbfce40e78 (patch)
treebfaea20071fd17bcc31cd5c75ff0b7ddce03a224 /src
parentb9d649c726fcd4635e26cf54624152cbe43c9d5e (diff)
downloadnotes-deb4619a79deace26923e91a93b6d7bbfce40e78.tar.gz
notes-deb4619a79deace26923e91a93b6d7bbfce40e78.zip
xargs: initial notesHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/SUMMARY.md1
-rw-r--r--src/cli/README.md1
-rw-r--r--src/cli/xargs.md23
3 files changed, 25 insertions, 0 deletions
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index e0a4a3e..62faeca 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -17,6 +17,7 @@
- [tac](./cli/tac.md)
- [rev](./cli/rev.md)
- [paste](./cli/paste.md)
+ - [xargs](./cli/xargs.md)
- [Tools](./tools/README.md)
- [tmux](./tools/tmux.md)
diff --git a/src/cli/README.md b/src/cli/README.md
index c20edc3..8144745 100644
--- a/src/cli/README.md
+++ b/src/cli/README.md
@@ -9,3 +9,4 @@
- [tac](./tac.md)
- [rev](./rev.md)
- [paste](./paste.md)
+- [xargs](./xargs.md) \ No newline at end of file
diff --git a/src/cli/xargs.md b/src/cli/xargs.md
new file mode 100644
index 0000000..a6f3c8c
--- /dev/null
+++ b/src/cli/xargs.md
@@ -0,0 +1,23 @@
+# xargs(1)
+
+```
+xargs [opts] [cmd [init-args]]
+ -l [<num>] maximal number of lines per cmd invocation
+ if <num> it not provided, num=1 is assumed
+ -I <str> replace <str> in the [init-args] with the arg;
+ this implies -l, and hence processes one arg at a time
+```
+
+## Example
+
+Collect arguments and prefix them with another option.
+```sh
+# Using -l to process one arg at a time.
+eval strace -f (find /dev -name 'std*' | xargs -l echo -P | xargs) ls
+
+# Using -I to place the arg at the specified location.
+eval strace -f (find /dev -name 'std*' | xargs -I {} echo -P {}) ls
+
+# Both commands achieve the same thing and result in something like:
+# eval strace -f -P /dev/stdin -P /dev/stdout -P /dev/stderr ls
+``` \ No newline at end of file