Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 51 lines (42 sloc) 881 Bytes
#!/bin/bash
for args in "$@"
do
fname=$(readlink -f "$args")
bname=$(basename "$fname")
dest1st=${bname%.*}
dest2nd=${dest1st%.*}
case "$bname" in
*.tar.gz | *.tar.bz2 | *.tar.xz | *.tar.7z)
destdir=${dest2nd};;
*)
destdir=${dest1st};;
esac
mkdir "$destdir"
if [ "$?" != "0" ]
then
echo Directory creating failed.
exit 1
fi
cd "$destdir"
case "$bname" in
*.tar.bz2 | *.tarbz2 | *.tbz2)
tar xvjf "$fname";;
*.tar.gz | *.targz | *.tgz)
tar xvzf "$fname";;
*.tar.xz | *.tarxz | *.txz)
tar xvJf "$fname";;
*.tar.7z | *.tar7z | *.t7z)
7z x -so "$fname" | tar xf -;;
*.zip | *.ZIP)
LANG=C 7z x "$fname"
fenc=$(find ./ -type f |enca -L zh -i)
[ "$?" = "0" ] && [ "$fenc" != "ASCII" ] && \
eval convmv -f $fenc -t UTF-8 --notest -r *;;
*.deb)
ar x "$fname";;
*)
7z x "$fname";;
esac
cd "$OLDPWD"
done
exit 0
You can’t perform that action at this time.