fork download
  1. #!/bin/bash
  2.  
  3. # ideone boilerplate: run in temp dir
  4. t=$(mktemp -d -t ideone.XXXXXXXX) || exit
  5. trap 'rm -rf "$t"' ERR EXIT
  6. cd "$t"
  7.  
  8. cat <<\: >pystat.py
  9. import os
  10. import sys
  11.  
  12. for filename in sys.argv[1:]:
  13. st = os.stat(filename)
  14. print(f"{st.st_size}\t{filename}")
  15. :
  16.  
  17. cat <<\: >plstat.pl
  18. #!/usr/bin/perl
  19. for $file (@ARGV) {
  20. print(join("\t", (stat($file))[7], $file), "\n")
  21. }
  22. :
  23.  
  24. echo Python
  25. python3 pystat.py /etc/shells /bin/ls
  26.  
  27. echo Python -c
  28. python3 -c 'import os; import sys;
  29. for filename in sys.argv[1:]:
  30. st = os.stat(filename)
  31. print(f"{st.st_size}\t{filename}")' /etc/shells /bin/ls
  32.  
  33. echo Perl
  34. perl plstat.pl /etc/shells /bin/ls
  35.  
  36. echo Perl -e
  37. perl -e 'for $file (@ARGV) { print(join("\t", (stat($file))[7], $file), "\n") }' /etc/shells /bin/ls
Success #stdin #stdout 0.05s 9240KB
stdin
Standard input is empty
stdout
Python
146	/etc/shells
137888	/bin/ls
Python -c
146	/etc/shells
137888	/bin/ls
Perl
146	/etc/shells
137888	/bin/ls
Perl -e
146	/etc/shells
137888	/bin/ls