diff options
Diffstat (limited to '.scripts/ext')
-rwxr-xr-x | .scripts/ext | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/.scripts/ext b/.scripts/ext index 3b41b1a..a1b9d0e 100755 --- a/.scripts/ext +++ b/.scripts/ext @@ -1,30 +1,30 @@ #!/usr/bin/env sh archive="$(readlink -f "$*")" && - directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && - mkdir -p "$directory" && - cd "$directory" || exit + directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && + mkdir -p "$directory" && + cd "$directory" || exit [ "$archive" = "" ] && printf "Give archive to extract as argument\\n" && exit if [ -f "$archive" ]; then - case "$archive" in - *.tar.bz2 | *.tbz2) tar xvjf "$archive" ;; - *.tar.xz) tar -xf "$archive" ;; - *.tar.gz | *.tgz) tar xvzf "$archive" ;; - *.tar.lz) tar --lzip -xvf "$archive" ;; - *.lzma) unlzma "$archive" ;; - *.bz2) bunzip2 "$archive" ;; - *.rar) unrar x -ad "$archive" ;; - *.gz) gunzip "$archive" ;; - *.tar) tar xvf "$archive" ;; - *.zip) unzip "$archive" ;; - *.Z) uncompress "$archive" ;; - *.7z) 7z x "$archive" ;; - *.xz) unxz "$archive" ;; - *.exe) cabextract "$archive" ;; - *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; - esac + case "$archive" in + *.tar.bz2 | *.tbz2) tar xvjf "$archive" ;; + *.tar.xz) tar -xf "$archive" ;; + *.tar.gz | *.tgz) tar xvzf "$archive" ;; + *.tar.lz) tar --lzip -xvf "$archive" ;; + *.lzma) unlzma "$archive" ;; + *.bz2) bunzip2 "$archive" ;; + *.rar) unrar x -ad "$archive" ;; + *.gz) gunzip "$archive" ;; + *.tar) tar xvf "$archive" ;; + *.zip) unzip "$archive" ;; + *.Z) uncompress "$archive" ;; + *.7z) 7z x "$archive" ;; + *.xz) unxz "$archive" ;; + *.exe) cabextract "$archive" ;; + *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;; + esac else - printf "File \"%s\" not found\\n" "$archive" + printf "File \"%s\" not found\\n" "$archive" fi |