Mercurial > hg > config
changeset 539:1eaf74615f72
.bashrc
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 27 Sep 2013 11:50:02 -0700 |
parents | 2881ea8897dc |
children | 8c9cd7472d28 |
files | .bashrc |
diffstat | 1 files changed, 40 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/.bashrc Fri Sep 27 11:36:39 2013 -0700 +++ b/.bashrc Fri Sep 27 11:50:02 2013 -0700 @@ -161,13 +161,6 @@ colors -eend() { - # edit the end of a file with emacs - FILE=$1 - shift - emacs +`wc -l "$FILE"` $@ -} - ### find functionality EXCLUDES="(\.svn)|(\.mo$)|(\.po$)|(\.pyc$)|(\.hg$)|(\.git$)" @@ -232,6 +225,8 @@ } +### functions for files + tmpfile() { # make a temporary file if `tempfile` not available @@ -254,29 +249,6 @@ done } -edpe() { - # edit and pipe the buffer to stdout - FILE=`tmpfile` - $EDITOR $FILE - cat $FILE - rm $FILE -} - -isrunning() { - # is a process running? (by name) - # see also: talos for a better version - for i in "$@" - do - ps axwww | grep "$i" | grep -v 'grep' - done | sort | uniq - -} - -killbyname() { - # kill a process by name - kill `isrunning "$@" | awk '{ print $1 }' | onelineit.py` -} - fn() { # full name python -c "import os; print os.path.realpath('$*')" @@ -310,6 +282,44 @@ mv "$NEWNAME" "$2" } + +### functions for editing + +edpe() { + # edit and pipe the buffer to stdout + FILE=`tmpfile` + $EDITOR $FILE + cat $FILE + rm $FILE +} + +eend() { + # edit the end of a file with emacs + FILE=$1 + shift + emacs +`wc -l "$FILE"` $@ +} + + +### functions for processes + +isrunning() { + # is a process running? (by name) + # see also: talos for a better version + for i in "$@" + do + ps axwww | grep "$i" | grep -v 'grep' + done | sort | uniq + +} + +killbyname() { + # kill a process by name + kill `isrunning "$@" | awk '{ print $1 }' | onelineit.py` +} + +### + buffer() { # temporary buffer with cat and /dev/null cat > /dev/null