Bash: Neuen Tab im neu geöffneten Terminal öffnen

Bash: Neuen Tab im neu geöffneten Terminal öffnen

Ich möchte neue Terminalfenster öffnen, jedes mit mehreren Tabs, und obwohl ich die Fenster öffnen konnte, habe ich Probleme mit den Tabs. Was ich derzeit habe, ist:

#!/bin/bash

# Opens new window, but with only one tab, code after --tab-with... does not work:
  gnome-terminal --window-with-profile=Bash -- bash -ic "command; bash;" --tab-with-profile=Bash -- bash -ic "command; bash;"

# This opens a new tab in the same terminal, not the one I created with the above command:
  ## gnome-terminal --tab-with-profile=Bash -- bash -ic "command; bash;"

# Correctly opens a new window:
  gnome-terminal --window-with-profile=Bash -- bash -ic "command; bash;"

exit;

Antwort1

Da die Frage noch offen war, gehe ich davon aus, dass Sie nicht gefunden haben, was Sie wollten. So oder so könnte es für zukünftige Besucher dieses Beitrags nützlich sein.

So können Sie es tun:

gnome-terminal -- bash -c "gnome-terminal --tab; bash"

Das basham Ende bewirkt, dass das Fenster geöffnet bleibt, sodass Sie die -iOption weglassen können.

Wenn Sie ein Fenster mit, sagen wir, 5 Tabs öffnen möchten, können Sie einfach eine For-Schleife einfügen:

// Loop 4 times since opening a window already starts us with 1 tab
gnome-terminal -- bash -c "for i in {1..4}; do gnome-terminal --tab; done; bash"

verwandte Informationen