Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xargs exits on empty line from stdin #435

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Commits on Jan 31, 2024

  1. xargs exits on empty line from stdin

    * BSD versions of xargs don't support the -l option
    * Standards document for xargs mentions -L but not -l [1]
    * Follow GNU version and accept -l as an alias for -L, but list standard -L in usage string
    * Behaviour of -L/-l didn't match xargs on my linux system: input loop was terminated on
      first empty line of STDIN
    * Skipping empty lines makes the behaviour match GNU version
    
    1. https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/xargs.html
    
    %cat -n in # not all lines have content
         1	#!/usr/bin/perl
         2	
         3	=begin metadata
         4	
         5	Name: awk
         6	Description: pattern-directed scanning and processing language
         7	Author: Tom Christiansen, tchrist@perl.com
         8	Author: Larry Wall, larry@wall.org
         9	License: perl
        10	
    
    %xargs -L 1 < in # implicit 'echo' for each line of stdin
    #!/usr/bin/perl
    =begin metadata
    Name: awk
    Description: pattern-directed scanning and processing language
    Author: Tom Christiansen, tchrist@perl.com
    Author: Larry Wall, larry@wall.org
    License: perl
    
    %perl xargs -L 1 < in # patched version
    #!/usr/bin/perl
    =begin metadata
    Name: awk
    Description: pattern-directed scanning and processing language
    Author: Tom Christiansen, tchrist@perl.com
    Author: Larry Wall, larry@wall.org
    License: perl
    mknos authored Jan 31, 2024
    Configuration menu
    Copy the full SHA
    7588281 View commit details
    Browse the repository at this point in the history