1

I would like to start terminal window via shell script with 2 splits opened in same window. One should do ssh and other one should change dir when opening. It needs to accept commands to be passed. (something similar to gnome-terminal --tab-with-profile). I'm looking for split window with profile and commands to execute while starting.

sudurais
  • 267

1 Answers1

1

The tmux and screen terminal multiplexers are often used for this.

session=$RANDOM
tmux new-session -s "$session" -d "ssh foohost"
tmux split-window -t "$session:0"
tmux send-keys -t "$session:0.1" "cd workdir" "Enter"
tmux attach -t "$session"
session=screen-$RANDOM
screen -dmS "$session"
screen -S "$session" -X ...I gave up.
grawity
  • 501,077