* /etc/zsh/zshrc: add alias 'any' for grepping through process
authorMichael Prokop <mika@grml.org>
Sat, 2 Dec 2006 10:51:33 +0000 (11:51 +0100)
committerMichael Prokop <mika@grml.org>
Sat, 2 Dec 2006 10:51:33 +0000 (11:51 +0100)
    list, thanks for the basic idea - Karl Voit!

debian/changelog
etc/zsh/zshrc

index bfa4be8..e7964ff 100644 (file)
@@ -1,3 +1,10 @@
+grml-etc-core (0.2.4) unstable; urgency=low
+
+  * /etc/zsh/zshrc: add alias 'any' for grepping through process
+    list, thanks for the basic idea - Karl Voit!
+
+ -- Michael Prokop <mika@grml.org>  Sat,  2 Dec 2006 11:51:06 +0100
+
 grml-etc-core (0.2.3) unstable; urgency=low
 
   * Let's ship /etc/apt/preferences.grml as reference file.
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