Created
December 13, 2021 18:21
-
-
Save Fawers/6752a4ff97af1d3373e2423aace8fe93 to your computer and use it in GitHub Desktop.
Untar ARCHIVE into DIR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function untar_into() { | |
[[ -z "$1" ]] && echo "No tar file specified" && return | |
[[ -z "$2" ]] && echo "No destination specified" && return | |
[[ ! -e "$1" ]] && echo "Specified tar file absent: $1" && return | |
[[ -e "$2" ]] && echo "Destination dir already exists: $2" && return | |
local archive=$1 | |
local target=$2 | |
mkdir -pv $target | |
mv $archive $target | |
cd $target | |
tar -xvf $archive | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment