sbc_compliant: (Default)
[personal profile] sbc_compliant
Found out some more today, during the instructor's tangent, that xargs is even more nifty than I thought.

To wit, some programs just don't take input from STDIN. This is one of the reasons for which xargs was created.

  • example:


    find foo bar baz | xargs ls -lad
    This allows ls, which normally cannot be passed parameters, to only operate on the output of the find, instead of the local directory. Also, I found out that the -d flag for ls ensures that the directories are not expanded.

  • example:


    find foo -print0 | xargs -0 ls -lad
    This, like above, allows ls operate on the output of the find. Additionally, the -print0 argument on the find makes the find able to read filenames with whitespace. This is done by swapping in a zero for the \s. Along with this, the -0 flag on xargs allows it to read this modified output.

Profile

sbc_compliant: (Default)
sbc_compliant

November 2019

S M T W T F S
     12
3456789
10111213141516
17181920212223
24252627282930

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 10th, 2026 06:35 am
Powered by Dreamwidth Studios