Add extract function to handle various archive types

This commit is contained in:
ushastoe
2025-11-05 11:55:55 +03:00
committed by GitHub
parent 081b2eec11
commit e0a5a2a563

19
.zshrc
View File

@@ -109,3 +109,22 @@ function a() {
echo "Неизвестная команда: a $1"
fi
}
extract() {
if [ -f "$1" ]; then
case "$1" in
*.tar.bz2) tar xvjf "$1" ;;
*.tar.gz) tar xvzf "$1" ;;
*.tar.xz) tar xvJf "$1" ;;
*.tar) tar xvf "$1" ;;
*.gz) gunzip "$1" ;;
*.zip) unzip "$1" ;;
*.rar) unrar x "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "Неизвестный формат: $1" ;;
esac
else
echo "Файл не найден: $1"
fi
}
alias x='extract'