how to automate gdb input via shellscript

Hi,

ich want to write a shellcode
which automates input such
#gdb file
...
(gdb)list
...
(gdb)break 10
...
(gdb)run AAAA
...
(gdb)bt
...

and so on.
I want to know how it is possible.

sincerely,
Blackbox

Try with expect

#cat script
list
break 10
run AAAA
bt

#gdb -x script a.out