Skip to content

Instantly share code, notes, and snippets.

@Shaun289
Created November 20, 2024 21:37
Show Gist options
  • Save Shaun289/a567f6732cb6e06cc53f26ce85357b65 to your computer and use it in GitHub Desktop.
Save Shaun289/a567f6732cb6e06cc53f26ce85357b65 to your computer and use it in GitHub Desktop.
Test xargs in macos
# Tested in macOS Sonoma 14.5
# Reference : https://johngrib.github.io/wiki/mac/terminal-guide/03/#-i-%EC%98%B5%EC%85%98%EA%B3%BC-placeholder
% echo $SHELL
/bin/zsh
% seq 10 | xargs -I {} echo {}
1
2
3
4
5
6
7
8
9
10
% touch test
% ls test
test
# run xargs with find
# xargs -I {} : set {} as placeholder usually.
# | : pipe
# rm -v : verbose
% find . -name test | xargs -I {} rm -v {}
./test
% ls test
ls: test: No such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment