1 2 3 4 5 6 7 8
#!/bin/sh if [[ -z $1 ]]; then echo "usage: gcore <pid>" exit 1 fi exec gdb -batch -ex "attach $1" -ex "generate-core-file" -ex "detach"