Advertisement
teknoraver

testcomp

Jul 6th, 2020
1,191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. dotest() {
  4.     format=${1##*.}
  5.     case "$format" in
  6.     gz) cmd=zcat ;;
  7.     bz2)    cmd=bzcat ;;
  8.     lzma)   cmd='lzmadec -c' ;;
  9.     xz) cmd=xzcat ;;
  10.     lz4)    cmd=lz4cat ;;
  11.     lzo)    cmd='lzop -cd' ;;
  12.     *) echo "Unsupported format $format"; return 1 ;;
  13.     esac
  14.  
  15.     echo "Testing $format"
  16.     for i in 1 2 3; do
  17.         time -f '%e' $cmd $1 >/dev/null
  18.     done
  19. }
  20.  
  21. for f; do
  22.     dotest $f
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement