Plan 9 from User Space's /usr/local/plan9/bin/stack

#!/usr/local/plan9/bin/rc

if(~ $#* 0)
	pid=core
if not
	pid=$1
shift
if(! ~ $pid [0-9] [0-9]*[0-9] */core *.core core.* */core.* core){
	name=$pid
	pid=`{psu|awk '$NF=="'$name'" {print $2}'}
	if(~ $#pid 0){
		echo 'stack: no process '$name
		exit none
	}
}
for(p in $pid)
	echo '$c' | 9 db -q $p $*

Space Glenda

Copyright © 2005 Lucent Technologies, Russ Cox, MIT.
See license for details.