Guest User

Untitled

a guest
Jun 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. function untarz {
  2. local tarfile=$1
  3. local root_count=`tar tfz $tarfile | cut -d / -f 1 | uniq | wc -l`
  4.  
  5. if [[ $root_count -gt 1 ]]; then
  6. echo "Warning! The given tarball has more than one root file. File not extracted."
  7. return 1
  8. else
  9. tar xzf $tarfile
  10. fi
  11. }
Add Comment
Please, Sign In to add comment