# HG changeset patch # User Jeff Hammel # Date 1380307802 25200 # Node ID 1eaf74615f721df3f3ae2a19b864d876640c70cf # Parent 2881ea8897dce7cd293e29e9339cf9a796c236db .bashrc diff -r 2881ea8897dc -r 1eaf74615f72 .bashrc --- 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