I'm writing bash scripts that launch a test scenarios: several programs that connect to each other.

If something crashed, I'd like to have a GDB command line.

Looks something like that:

myprogram <(cat <<-EOM
    par = abc
) &>>"$3" &

sleep 1

grep -q DATA <(timeout 5 myclient http://url | tee -a "$3") && exit 0

sleep 5&
wait %+

exit 1

I've tried to launch with gdb from the start (using sleep as an example application):

gdb -ex run --args sleep 30 &

And then:


The fg doesn't bring it back properly: can't type anything, SIGINT is strange, shell says that the job is stopped. Writing fg inside the script gives an error fg: no job control.

Is there a way?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.