From 8dbb360357f9d8db110a0e2e130a15eceb4a0f8d Mon Sep 17 00:00:00 2001 From: Bodaniel Jeanes Date: Wed, 30 Jun 2010 21:21:38 +1000 Subject: [PATCH] Moved functions into own file --- shell/aliases.sh | 36 +----------------------------------- shell/common.sh | 1 + shell/functions.sh | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 shell/functions.sh diff --git a/shell/aliases.sh b/shell/aliases.sh index 871491c..6b3f798 100644 --- a/shell/aliases.sh +++ b/shell/aliases.sh @@ -33,38 +33,4 @@ alias r='rake' alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"' alias pubkey="cat $HOME/.ssh/*.pub" -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 -} \ No newline at end of file +alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors \ No newline at end of file diff --git a/shell/common.sh b/shell/common.sh index ad6869d..5a0e630 100644 --- a/shell/common.sh +++ b/shell/common.sh @@ -4,6 +4,7 @@ CDPATH=".:${HOME}" source $DOT_FILES/$CURRENT_SHELL/config.*sh source $DOT_FILES/shell/exports.sh source $DOT_FILES/shell/aliases.sh +source $DOT_FILES/shell/functions.sh source $DOT_FILES/shell/save-directory.sh source $DOT_FILES/shell/prompt.sh source $DOT_FILES/shell/git.sh diff --git a/shell/functions.sh b/shell/functions.sh new file mode 100644 index 0000000..a18767a --- /dev/null +++ b/shell/functions.sh @@ -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 +} \ No newline at end of file