One Thing Well

A weblog about simple, useful software.

You can follow along on Twitter or via the feed. Don't hesitate to get in touch. Sponsor the site.

any

A very handy function for your ~/.zshrc—cribbed from the Grml distro’s excellent zsh config—that lets you search for running processes:

any() {
    emulate -L zsh
    unsetopt KSH_ARRAYS
    if [[ -z "$1" ]] ; then
        echo "any - grep for process(es) by keyword" >&2
        echo "Usage: any " >&2 ; return 1
    else
        ps xauwww | grep -i --color=auto "[${1[1]}]${1[2,-1]}"
    fi
}