Alias for extracting archives.

This commit is contained in:
Artem Sapegin 2012-10-19 15:16:29 +04:00
parent 9baf769a41
commit da7a90c337
2 changed files with 25 additions and 1 deletions

View File

@ -33,4 +33,27 @@ function unidecode() {
function codepoint() {
perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))"
echo # newline
}
}
# Extract archives of various types
function extract() {
if [ -f $1 ] ; then
local dir_name=${1%.*} # Filename without extension
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.tar.xz) tar Jxvf $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.zip) unzip -d$dir_name $1 ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

View File

@ -24,6 +24,7 @@ brew install homebrew/dupes/grep
# Install everything else
brew install git
brew install git-extras
brew install unrar
#brew install node
# Remove outdated versions from the cellar