Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 24 lines (18 sloc) 670 Bytes
#!/usr/bin/env bash
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
Get PIDs
Usage: $(basename "$0") [processname [processname ...]]
Get the PIDs of all matching processes for all specified processnames.
If no arguments are passed, list processes by PID, TTY, USER, COMMAND.
Copyright (c) 2012 "Cowboy" Ben Alman
Licensed under the MIT license.
exit; fi
if [ ! "$1" ]; then
ps axo pid,tty,user,command
args="$1"; shift; for arg in "$@"; do args="${args}|${arg}"; done
echo $(ps axo pid,tty,user,command | perl -nle"m#^\s*(\d+).*(?:$args)# && !m#.dotfiles/bin/pid# && print \$1")