Open python script in a new terminal tab [Linux/Bash/Python]

0

I have lots of servers written in Python. I want to run them, one script per one terminal tab. I'm using Xubuntu 16.04.

I know how to open the terminal tab in Xubuntu inside the bash script:

#!/bin/bash
xfce4-terminal --tab

Also, I know how to run python script in bash script:

#!/bin/bash
python server_1.py

But how can I open a new tab, and run the script in this new, opened tab?

mirx

Posted 2017-03-31T09:13:02.287

Reputation: 197

Answers

1

There are the -x and -e options, have you tried them?

-x, --execute
    Execute the remainder of the command line inside the terminal
-e, --command=command
    Execute command inside the terminal

Ie. something like:

xfce4-terminal --tab --execute python server_1.py

If there is a problem with the skript path, you can specify the working directory with:

--working-directory=directory

DocWeird

Posted 2017-03-31T09:13:02.287

Reputation: 1 201

I have weird errors when trying the --working-directory=directory (terminal has closed immediately) but the -x option works. Thank you for help. – mirx – 2017-03-31T10:34:49.277