Created
June 19, 2013 02:51
-
-
Save warewolf/5811359 to your computer and use it in GitHub Desktop.
Stupid hacks: catl (cat loop) - repeatedly print something to STDOUT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| $ARGV[0]="-"if($ARGV[0]eq"");open(F,$ARGV[0])||die$!;binmode(F);if($ARGV[0]=~ | |
| /^-$|^$/||$ARGV[0]){while(!eof(F)){read(F,$d,1024);$s.=$d}}select(STDOUT);$|= | |
| 1;while(1){if($ARGV[0]ne"-"){seek(F,0,0);while(!eof(F)){read(F,$s,1024);print | |
| STDOUT$s;}}else{print STDOUT$s;}}close F;# catl v1.0, (C) [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment