Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- # To create sound file:
- # youtube-dl -x "https://www.youtube.com/watch?v=MFw3E6X5aoA" --audio-format vorbis -o ~/noot-noot.mp4
- $| = 1;
- my $fh;
- open($fh, "-|", "/usr/bin/ping", @ARGV) or die "Can't run ping: $!";
- while(my $line = <$fh>) {
- chomp $line;
- print $line;
- if ( $line =~ /^\d+ bytes from/ ) {
- print " (noot noot!)";
- if ( system("/usr/bin/paplay", "$ENV{HOME}/noot-noot.ogg") != 0 ) {
- close $fh if ( ($? & 127) == 2 );
- }
- }
- print "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment