Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #/bin/bash
  2.  
  3. exit="false"
  4.  
  5. #filein="$(ls -ltcr /tmp/test/ | tail -n 1 | awk '{ print $9 }')"
  6.  
  7. #echo "$filein"
  8.  
  9. while [ "$exit" = "false" ];do
  10.  
  11. filein="$(ls -ltcr /tmp/test/ | tail -n 1 | awk '{print $9 }')"
  12.  
  13. if [ "$(file $filein | grep tar)" ];then
  14. mv "$filein" "$filein.tar"
  15. tar -xvf "$filein.tar"
  16. rm "$filein"
  17. echo "untar'd"
  18. elif [ "$(file $filein | grep bzip)" ];then
  19. mv "$filein" "$filein.bz2"
  20. bzip2 -d "$filein.bz2"
  21. echo "un-bzip2'd"
  22. elif [ "$(file $filein | grep gzip)" ];then
  23. mv "$filein" "$filein.gz"
  24. gzip -d "$filein.gz"
  25. echo "ungzip'd"
  26. elif [ "$(file $filein | grep ASCII)" ];then
  27. cat $filein
  28. break
  29. fi
  30.  
  31. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement