Pergunta

I need an example of gnome-terminal command to read lines of text from a file and executes them one by one in different terminal or a tab.

So this would be the process. I would run gnome terminal command and it would read 10 commands from a file. Then it would execute those 10 commands in 10 different tabs/terminals. And of course those tabs/terminals would remain opened. I found this question Avoid gnome-terminal close after script execution?

The third answer from the top is very helpful. I managed to open 1 command from a file. But I need 1 file with 10 command lines to be opened like I wrote above.

Thanks.

Foi útil?

Solução

I recommend to use screen for this, if that can be acceptable to you.

You could create a commands.screenrc file like this:

screen bash -c 'command1; echo press any key; read'
screen bash -c 'command2; bash'
screen mutt
screen emacs
screen

You can define as many programs as you want. Start screen with:

screen -c commands.screenrc

I don't know what kind of commands you want to run. If you want to see their output, then write like the first example above: execute the command in a bash shell, which will "pause" after the command was executed. Or the second line, which, after running the command will start another bash shell. Otherwise the screen window would exit automatically.

If you are not familiar with screen, you will need to learn some basic key strokes to get around, and to be able to switch between windows. The first few pages of this presentation should be enough to get you started.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top