bin/ex: readd support for zips on systems without 7zip
This commit is contained in:
parent
07fade09c3
commit
1f2b734fd7
|
@ -19,8 +19,11 @@ for arg do
|
||||||
(*.tar.*|*.tar) tar --extract --file "$path";;
|
(*.tar.*|*.tar) tar --extract --file "$path";;
|
||||||
(*.tbz2) tar xjf "$path" ;;
|
(*.tbz2) tar xjf "$path" ;;
|
||||||
(*.tgz) tar xzf "$path" ;;
|
(*.tgz) tar xzf "$path" ;;
|
||||||
#(*.zip|*.jar) unzip "$path" | rewrite ;;
|
(*.7z|*.z01|*.zip|*.jar)
|
||||||
(*.7z|*.z01|*.zip|*.jar) 7z x "$path" ;;
|
if which 7z >/dev/null
|
||||||
|
then 7z x "$path"
|
||||||
|
else unzip "$path" | rewrite
|
||||||
|
fi;;
|
||||||
(*.gz) gunzip "$path" ;;
|
(*.gz) gunzip "$path" ;;
|
||||||
(*.bz2) bunzip2 "$path" ;;
|
(*.bz2) bunzip2 "$path" ;;
|
||||||
(*.rar) unrar x "$path" ;;
|
(*.rar) unrar x "$path" ;;
|
||||||
|
@ -30,7 +33,7 @@ for arg do
|
||||||
(*) echo "'$arg' cannot be extracted by ex" >&2;;
|
(*) echo "'$arg' cannot be extracted by ex" >&2;;
|
||||||
esac
|
esac
|
||||||
test "$(basename "$PWD")" = "$namepart" &&
|
test "$(basename "$PWD")" = "$namepart" &&
|
||||||
if test $# -lt 2 && "$(ls -U | wc -l)" -lt 3
|
if test $# -lt 2 -a "$(ls -U | wc -l)" -lt 3
|
||||||
then mv * .. && cd .. && rm -d "$namepart"
|
then mv * .. && cd .. && rm -d "$namepart"
|
||||||
else cd .. && mv "$namepart" "$name"
|
else cd .. && mv "$namepart" "$name"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue