From a0cb586db00052329d1f3517dce39700ec0b0575 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sat, 2 Dec 2006 11:51:33 +0100 Subject: [PATCH] * /etc/zsh/zshrc: add alias 'any' for grepping through process list, thanks for the basic idea - Karl Voit! --- debian/changelog | 7 +++++++ etc/zsh/zshrc | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/debian/changelog b/debian/changelog index bfa4be8..e7964ff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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. diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 8e88d41..528c3ee 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -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 " >&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 -- 2.1.4