fork download
  1. #!/bin/bash
  2.  
  3. # ideone boilerplate - we can't write files in the home directory;
  4. # so create a temporary directory for our files instead
  5. t=$(mktemp -d -t ideone.XXXXXXXXXXXX) || exit
  6. trap 'rm -rf "$t"' ERR EXIT
  7. cd "$t"
  8.  
  9. mkdir pages
  10.  
  11. tr '~' '\r' <<\: >pages/first.js
  12. hello.world();~
  13. console.log("Debug info");~
  14. foo.bar();~
  15. :
  16.  
  17. tr '~' '\r' <<\: >pages/second.js
  18. first.function();~
  19. console.log("my hovercraft is full of eels");~
  20. another.operation();~
  21. console.log("all your base are belong to us");~
  22. final.call();~
  23. :
  24.  
  25. tr '~' '\r' <<\: >pages/third.js
  26. bug.here("this contains console.log but should properly not be deleted");~
  27. :
  28.  
  29. tail pages/** | cat -v
  30.  
  31. perl -ni -e 'print unless /console\.log/' pages/**
  32.  
  33. echo '** after'
  34.  
  35. tail pages/** | cat -v
  36.  
Success #stdin #stdout 0.02s 5548KB
stdin
Standard input is empty
stdout
==> pages/first.js <==
hello.world();^M
console.log("Debug info");^M
foo.bar();^M

==> pages/second.js <==
first.function();^M
console.log("my hovercraft is full of eels");^M
another.operation();^M
console.log("all your base are belong to us");^M
final.call();^M

==> pages/third.js <==
bug.here("this contains console.log but should properly not be deleted");^M
** after
==> pages/first.js <==
hello.world();^M
foo.bar();^M

==> pages/second.js <==
first.function();^M
another.operation();^M
final.call();^M

==> pages/third.js <==