3

I run a script when I log in that basically looks like this:

chromium-browser &
xchat &
cd ~/randomdir && gnome-terminal &
qbittorrent &

On the third line (cd ~/randomdir && gnome-terminal &), I would like to run another script in the terminal that I'm opening up. How can I do that in this script?

Raja G
  • 105,327
  • 107
  • 262
  • 331
ike
  • 1,260

2 Answers2

4

Run a non-interactive shell that runs your script and then replaces itself with an interactive bash shell.

gnome-terminal --working-directory="$HOME/randomdir" -x bash -c './randomscript; exec bash' &
geirha
  • 47,279
3

gnome-terminal --working-directory=randomdir

Is this what you are looking for?

By the way, man gnome-terminal should help :)

EDIT:

However, if you want to keep the terminal open you can do this:

gnome-terminal --working-directory=randomdir -e COMMAND #launch the command - terminal will close
gnome-terminal --working-directory=randomdir #open a new terminal with the same default path

These 2 commands added in your script.