comparison scripts/pid2name.sh @ 75:aa2fd199ba56

improve pid2name script
author smith@nwoca.org
date Wed, 23 Mar 2016 16:39:31 +0100
parents 334d65dac778
children
comparison
equal deleted inserted replaced
74:541766977a11 75:aa2fd199ba56
1 #!/bin/bash 1 #!/bin/bash
2 # determines the docker container name of a PID on docker host.
2 docker ps -q | xargs docker inspect --format '{{.State.Pid}} {{.Name}}' \ 3 docker ps -q | xargs docker inspect --format '{{.State.Pid}} {{.Name}}' \
3 | grep "^$1" | sed 's/^.*\///g' 4 | grep "^${1?specify pid of process on host}" | sed 's/^.*\///g'
4 5