Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function untarz {
- local tarfile=$1
- local root_count=`tar tfz $tarfile | cut -d / -f 1 | uniq | wc -l`
- if [[ $root_count -gt 1 ]]; then
- echo "Warning! The given tarball has more than one root file. File not extracted."
- return 1
- else
- tar xzf $tarfile
- fi
- }
Add Comment
Please, Sign In to add comment