fork download
  1. #!/bin/bash
  2.  
  3. d=$(mktemp -d -t) || exit
  4. cd "$d"
  5.  
  6. printf 'no eol' >first
  7. printf 'no final eol\nnot here' >second
  8. printf 'has eol\n' >third
  9. printf 'has eol\ntoo\n' >fourth
  10.  
  11.  
  12. for f in *; do
  13. diff -u /dev/null "$f"
  14. done
  15.  
  16. printf '%s\n' '------------------'
  17.  
  18. for f in *; do
  19. awk 1 "$f" >tmp
  20. cmp -s tmp "$f" || mv tmp "$f"
  21. done
  22. rm -f tmp
  23.  
  24. for f in *; do
  25. diff -u /dev/null "$f"
  26. done
  27.  
Runtime error #stdin #stdout 0s 5840KB
stdin
Standard input is empty
stdout
--- /dev/null	2015-07-21 23:17:51.000000000 +0000
+++ first	2015-08-29 07:50:30.005491177 +0000
@@ -0,0 +1 @@
+no eol
\ No newline at end of file
--- /dev/null	2015-07-21 23:17:51.000000000 +0000
+++ fourth	2015-08-29 07:50:30.005491177 +0000
@@ -0,0 +1,2 @@
+has eol
+too
--- /dev/null	2015-07-21 23:17:51.000000000 +0000
+++ second	2015-08-29 07:50:30.005491177 +0000
@@ -0,0 +1,2 @@
+no final eol
+not here
\ No newline at end of file
--- /dev/null	2015-07-21 23:17:51.000000000 +0000
+++ third	2015-08-29 07:50:30.005491177 +0000
@@ -0,0 +1 @@
+has eol
------------------
--- /dev/null	2015-07-21 23:17:51.000000000 +0000
+++ first	2015-08-29 07:50:30.012494384 +0000
@@ -0,0 +1 @@
+no eol
--- /dev/null	2015-07-21 23:17:51.000000000 +0000
+++ fourth	2015-08-29 07:50:30.005491177 +0000
@@ -0,0 +1,2 @@
+has eol
+too
--- /dev/null	2015-07-21 23:17:51.000000000 +0000
+++ second	2015-08-29 07:50:30.019497607 +0000
@@ -0,0 +1,2 @@
+no final eol
+not here
--- /dev/null	2015-07-21 23:17:51.000000000 +0000
+++ third	2015-08-29 07:50:30.005491177 +0000
@@ -0,0 +1 @@
+has eol