0

I want to run two terminals with follwing options.

1)

gdb drizzle

2)

gdb drizzled << EOF

If I start the script with gnome-terminal or xterm it doesn't run the commands I give it afterwards.

aj_
  • 19
  • 7

2 Answers2

1

1)

xterm -e gdb drizzle

2)

xterm -e bash -c 'gdb drizzled <<EOF
heredoc ...
EOF'

The -e option to xterm doesn't run a shell, so you need to invoke bash explicitly if you want to use shell features like here-doc.

If you want the xterm to stick around after a command executes, use:

xterm -e bash -c 'command; echo Press return to exit; read x'
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • The xterm window disappears if I try to execute a very small program. any workaround? – aj_ Sep 18 '13 at 18:23
  • Added that to answer. – Barmar Sep 18 '13 at 18:30
  • Thank you Barmar. If I do 'gdb drizzled << EOF' and doesn't provide EOF in the end, it implicitly assumes EOF in the end and ends the gdb session. I want the gdb session to be active. – aj_ Sep 18 '13 at 18:41
  • That's right. Bash's stdin is redirected to the -c argument, so reaching the end of the argument is EOF to bash. – Barmar Sep 18 '13 at 18:47
0

I think you added an extra d on your command:

gdb drizzled << EOF

Should perhaps be

gdb drizzle << EOF

Also it depends on the commands you placed after EOF.

konsolebox
  • 72,135
  • 12
  • 99
  • 105