* /etc/zsh/zshrc: add alias 'any' for grepping through process
[grml-etc-core.git] / etc / zsh / zshrc
index 8e88d41..528c3ee 100644 (file)
@@ -916,6 +916,20 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
 
   type -p fma &>/dev/null && alias ?='fma zshall'
 
+  # grep for running process, like: 'any vim'
+  any() {
+  if [ -z "$1" ] ; then
+     echo "any - grep for process(es) by keyword" >&2
+     echo "Usage: any <keyword>" >&2 ; return 1
+  else
+     local STRING=$1
+     local LENGTH=$(expr length $STRING)
+     local FIRSCHAR=$(echo $(expr substr $STRING 1 1))
+     local REST=$(echo $(expr substr $STRING 2 $LENGTH))
+     ps xauwww| grep [$FIRSCHAR]$REST
+  fi
+  }
+
 # }}}
 
 # {{{ make sure our environment is clean regarding colors