Bash: 새로 열린 터미널에서 새 탭 열기

Bash: 새로 열린 터미널에서 새 탭 열기

각각 여러 개의 탭이 있는 새 터미널 창을 열고 싶습니다. 창을 열었지만 탭에 문제가 있습니다. 내가 현재 가지고 있는 것은 다음과 같습니다.

#!/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;

답변1

질문이 아직 열려 있으므로 원하는 것을 찾지 못했다고 가정합니다. 어느 쪽이든 이 게시물을 방문하는 향후 방문자에게 유용할 수 있습니다.

방법은 다음과 같습니다.

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

마지막 bash에는 창이 계속 열려 있도록 하므로 -i옵션을 생략할 수 있습니다.

예를 들어 5개의 탭이 있는 창을 열려면 for 루프를 사용하면 됩니다.

// 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"

관련 정보