Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For all the pipe lovers in this thread, here is a Perl utility I wrote to help debug shell pipelines. I call it `echoin`, and whatever it takes on stdin, it prints to stdout (presumably the terminal) while also treating its arguments as a command (sort of like xargs) and repeating its input for that command's stdin. So I can do:

    foo | echoin bar
This is like `foo | bar`, but I can see what's passing between them. It's a bit like `tee`, but reversed. It's what I irrationally want `foo | tee - | bar` to do.

    my $args = join ' ', @ARGV;

    open OUT, "|$args"  or die "Can't run $args: $!\n";
    while (<STDIN>) {
      print $_;
      print OUT $_;
    }


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: