Tutorial Dateien.

This commit is contained in:
2026-04-05 12:23:06 +02:00
parent 01372ed6dd
commit 23d29820b4
4 changed files with 113 additions and 0 deletions

46
teil28/.bash_func Normal file
View File

@@ -0,0 +1,46 @@
function extract () {
file_type=$(file -b ${1})
file_type=${file_type%%,*}
if [ -f ${1} ] ; then
case ${file_type} in
"bzip2 compressed data")
tar xjvf "${1}"
;;
"gzip compressed data")
gunzip "${1}"
;;
"XZ compressed data")
xz -d "${1}"
;;
"bzip2 compressed data")
bzip2 -d "${1}"
;;
"RAR archive data")
unrar2dir "${1}"
;;
"POSIX tar archive (GNU)")
tar xf "${1}"
;;
"Zip archive data")
unzip "${1}"
;;
"compress'd data 16 bits")
uncompress "${1}"
;;
"7-zip archive data")
7z x "${1}"
;;
"Zstandard compressed data"*)
zstd -d "${1}"
;;
*)
echo "'$1' cannot be extracted via extract()"
;;
esac
else
echo "'${1}' not found."
exit 1
fi
}