From: Ian Kelling <ian@iankelling.org>
Date: Thu, 6 Apr 2017 21:05:35 +0000 (-0700)
Subject: fix tar priority
X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=02239b8021771f96788497c79161fb078898c576;p=small-misc-bash

fix tar priority
---

diff --git a/ex b/ex
index ff8edb7..cd9bd78 100755
--- a/ex
+++ b/ex
@@ -28,6 +28,12 @@ Note: dtrx (package & command) extracts most of these plus some others."
     local x super
     for x in "$@"; do
         case "$x" in
+            # tars first, so they are higher pri than non-tar extensions
+            *.tar ) tar xf "$x" ;;
+            *.tar.bz2 | *.tbz2 ) tar xjf "$x" ;;
+            *.tar.gz | *.tgz ) tar xzf "$x" ;;
+            *.tar.xz ) tar Jxf "$x" ;;
+            *.xz) xz -d "$x" ;;
             *.7z ) 7za x "$x" ;;
             *.bz2 ) bunzip2 "$x" ;;
             *.deb ) ar x "$x" ;;
@@ -50,11 +56,6 @@ Note: dtrx (package & command) extracts most of these plus some others."
             *.r[0-9][0-9]|*.rar ) unrar x "$x" ;;
             *.rpm ) rpm2cpio "$x" | cpio --extract --make-directories ;;
             *.sfs) $super unsquashfs "$x" ;;
-            *.tar ) tar xf "$x" ;;
-            *.tar.bz2 | *.tbz2 ) tar xjf "$x" ;;
-            *.tar.gz | *.tgz ) tar xzf "$x" ;;
-            *.tar.xz ) tar Jxf "$x" ;;
-            *.xz) xz -d "$x" ;;
             *.Z ) uncompress "$x" ;;
             *.zip|*.xpi ) unzip "$x" ;;