I want open a screen on host1 and change directory to $HOME/bin. host2 and change directory to $HOME/prj.
这里是我的手稿,但骑手可以工作。
#!/bin/bash
start_host() {
screen ssh $1
sleep 1
screen -X chdir $2
}
[ x"$TERM" = x"screen" ] || exec screen -ln -S xxx -c /dev/null $0
sleep 1
screen -X zombie cr
screen -X caption always "%{= wk}%-w%{= BW}%n:%t%{-}%+w%-="
screen /bin/bash
start_host host1 bin
start_host host2 prj