-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmvdc.sh
executable file
·98 lines (93 loc) · 2.19 KB
/
mvdc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
##############################################################################
## ##
## mvdc is a file decompress manager easy and simpler for the linux. ##
## ##
##############################################################################
# Help
function help() {
echo "usage: mvdc <file>"
echo " where file are [examples]:"
echo " bar.zip or bar.tar.gz"
exit 1
}
if [ ! -r $1 ]; then
help
fi
if [ $# -eq 0 ]; then
help
fi
tipo=$(file -i $1 | grep zip:)
if [ ${#tipo} != 0 ]; then
if ! type which unzip >/dev/null; then
sudo apt install unzip -y
fi
unzip $1
fi
tipo=$(file -i $1 | grep tar:)
if [ ${#tipo} != 0 ]; then
if ! type which tar >/dev/null; then
sudo apt install tar -y
fi
tar -xvf $1
fi
tipo=$(file -i $1 | grep gz:)
if [ ${#tipo} != 0 ]; then
tipo=$(file -i $1 | grep .tar.gz:)
if [ ${#tipo} != 0 ]; then
if ! type which tar >/dev/null; then
sudo apt install tar -y
fi
tar -xzvf $1
else
tipo=$(file -i $1 | grep .tgz:)
if [ ${#tipo} != 0 ]; then
if ! type which tar >/dev/null; then
sudo apt install tar -y
fi
tar -xzvf $1
else
if ! type which gzip >/dev/null; then
sudo apt install gzip -y
fi
gzip -d $1
fi
fi
fi
tipo=$(file -i $1 | grep bz2)
if [ ${#tipo} != 0 ]; then
if ! type which bzip2 >/dev/null; then
sudo apt install bzip2 -y
fi
tipo=$(file -i $1 | grep .tar.bz2:)
if [ ${#tipo} != 0 ]; then
if ! type which tar >/dev/null; then
sudo apt install tar -y
fi
bzip2 -dc $1 | tar -xv
else
bzip2 -d $1
fi
fi
tipo=$(file -i $1 | grep .lzma)
if [ ${#tipo} != 0 ]; then
if ! type which lzma >/dev/null; then
sudo apt install lzma -y
fi
lzma -d $1
fi
tipo=$(file -i $1 | grep .rar)
if [ ${#tipo} != 0 ]; then
if ! type which rar >/dev/null; then
sudo apt install rar -y
fi
rar -x $1
fi
tipo=$(file -i $1 | grep .7z)
if [ ${#tipo} != 0 ]; then
if ! type which p7zip-full >/dev/null; then
sudo apt install p7zip-full -y
fi
7za e $1
fi
echo "Descompress finish."