Search code examples
shellterminalxtermgnome-terminal

How to create a shell script to launch 3 terminals and execute a set of commands in each?


Currently, I open 3 terminals ('openocd session','telnet session' & 'gdb session') and execute 'a set of commands' in each terminal every time I flash my image on target.

Is is possible to put this in one shell script file and run at once? (Commands on each terminal are NOT dependent on others; except that the terminals should be opened in the order mentioned above)

Thanks in advance !


Solution

  • Which terminal are you using?

    A terminal like xterm can start a program instead of a shell. Simply run

    xterm -e 'command args ...'
    

    I use this to start my email client:

    xterm -e mutt
    

    If you use a different terminal, consult its manual page. I'm pretty sure there's an equivalent for -e.