Add utilities plugin with archive extract
command
This commit is contained in:
parent
ce65ae40bc
commit
b842fb6437
24
utilities/utilities.plugin.zsh
Normal file
24
utilities/utilities.plugin.zsh
Normal file
@ -0,0 +1,24 @@
|
||||
# A collection of various shell utilities.
|
||||
|
||||
# Detect the type and extract an archive file.
|
||||
extract() {
|
||||
if [ -f $1 ]; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xvjf $1 ;;
|
||||
*.tar.gz) tar xvzf $1 ;;
|
||||
*.tar.xz) gunzip $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xvf $1 ;;
|
||||
*.tbz2) tar xvjf $1 ;;
|
||||
*.tgz) tar xvzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7zr x $1 ;;
|
||||
*) echo "error: unable to extract '$1'" ;;
|
||||
esac
|
||||
else
|
||||
echo "error: file not found '$1'"
|
||||
fi
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user