Moved functions into own file

pull/2/head
Bodaniel Jeanes 2010-06-30 21:21:38 +10:00
parent 8767ed612a
commit 8dbb360357
3 changed files with 35 additions and 35 deletions

View File

@ -33,38 +33,4 @@ alias r='rake'
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"' alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
alias pubkey="cat $HOME/.ssh/*.pub" alias pubkey="cat $HOME/.ssh/*.pub"
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
function f() { find * -name $1; }
function p() {
cd $* && m
}
function m() {
if [ -n "$*" ]; then
files=$*
else
files=.
fi
mate -l1 $files 2>/dev/null
}
function extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $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) 7z x $1 ;;
*) echo "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

View File

@ -4,6 +4,7 @@ CDPATH=".:${HOME}"
source $DOT_FILES/$CURRENT_SHELL/config.*sh source $DOT_FILES/$CURRENT_SHELL/config.*sh
source $DOT_FILES/shell/exports.sh source $DOT_FILES/shell/exports.sh
source $DOT_FILES/shell/aliases.sh source $DOT_FILES/shell/aliases.sh
source $DOT_FILES/shell/functions.sh
source $DOT_FILES/shell/save-directory.sh source $DOT_FILES/shell/save-directory.sh
source $DOT_FILES/shell/prompt.sh source $DOT_FILES/shell/prompt.sh
source $DOT_FILES/shell/git.sh source $DOT_FILES/shell/git.sh

33
shell/functions.sh 100644
View File

@ -0,0 +1,33 @@
function f() { find * -name $1; }
function p() {
cd $* && m
}
function m() {
if [ -n "$*" ]; then
files=$*
else
files=.
fi
mate -l1 $files 2>/dev/null
}
function extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $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) 7z x $1 ;;
*) echo "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file"
fi
}