Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
executable file 24 lines (18 sloc) 0.67 kb
#!/usr/bin/env bash
if [[ "$1" == "-h" || "$1" == "--help" ]]; then cat <<HELP
Get PIDs
http://benalman.com/
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.
http://benalman.com/about/license/
HELP
exit; fi
if [ ! "$1" ]; then
ps axo pid,tty,user,command
else
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")
fi
Jump to Line
Something went wrong with that request. Please try again.