Last active
February 4, 2024 12:08
-
-
Save bionade24/54aa86c909023a2a5a68948a3b59d61d to your computer and use it in GitHub Desktop.
unzip wrapper to unzip into a new 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
#!/usr/bin/env bash | |
#If arguments are provided or called by another script, use normal unzip behaviour | |
if [[ (($# > 1)) || ( (($SHLVL > 2)) && -z ${TMUX} ) || (($SHLVL > 3)) ]]; then | |
/usr/bin/unzip "$@"; | |
else | |
NAME=$(echo "${1}" | sed s/\ /_/g | sed s/\.zip//) | |
mkdir $NAME | |
/usr/bin/unzip "${1}" -d "$NAME"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment