Hi, On Monday 20 February 2006 20:10, Ken Schneider wrote:
...
This is one that I use...
ps auxww | grep -v grep | grep $*
Using "pidof" obviates the grep to remove the grep(s). My take on this, which I use quite frequently, is called "psp": -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- #!/bin/bash --norc while [ $# -gt 0 ]; do arg="$1" case "$arg" in -) shift break ;; -*) break ;; *) targets=( "${targets[@]}" "$arg" ) PIDs=( $(pidof "$arg") ) if [ ${#PIDs[*]} -eq 0 ]; then echo "psp: No process running named \"$arg\"" >&2 fi targetPIDs=( ${targetPIDs[*]} ${PIDs[@]} ) ;; esac shift done if [ ${#targetPIDs[*]} -eq 0 ]; then echo "psp: No target processes running" >&2 exit 1 fi ps "$@" ${targetPIDs[@]} -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- Arguments up to the first one that starts with a hyphen are program names. The rest, if any, are passed to ps as the leading arguments followed by any PIDs discovered (by pidof) for the specified program names. If the first non-program-name argument is a single hyphen, it is not passed to ps.
Ken Schneider
Randall Schulz