Permalink
Browse files

`cat-safe` that ensures contents of files always finishes with a newline

  • Loading branch information...
1 parent 4cd760a commit 0d9eff7cfa605b8263bca103c295ddbbc4a918e3 @mislav committed Apr 27, 2010
Showing with 8 additions and 0 deletions.
  1. +8 −0 bin/cat-safe
View
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby -wKU
+$stdout.sync = true
+
+for path in ARGV
+ File.open(path, 'r') do |file|
+ file.each_line { |line| puts line }
+ end
+end

0 comments on commit 0d9eff7

Please sign in to comment.