tmux自动化 发表于 2017-12-18 | 分类于 技术积累 | | 1234#!/bin/bashtmux new -s htop \; neww -d 'cd ~/ && htop' \; splitw -d \; selectp -t 1 \; detachtmux new -s top \; neww -d 'cd ~/ && top' \; splitw -d \; selectp -t 1 \; detach 123456#!/bin/bashtmux new -s htop \; \ send-keys -t htop:0 'cd ~/ && htop' C-m \; \ splitw -d \; selectp -t 1 \; \ send-keys -t htop:0.1 'cd ~/ && clear' C-m \; detach 123456789101112#!/bin/bashCMDS=( "htop" "top" )CMDPATH="~"for cmd in "${CMDS[@]}"do tmux new -s $cmd \; \ send-keys -t $cmd:0 'cd '$CMDPATH' && '$cmd C-m \; \ splitw -d \; selectp -t 1 \; \ send-keys -t $cmd:0.1 'cd '$CMDPATH' && clear' C-m \; detachdone 123456789101112131415161718#!/bin/bashservs = ("cashier" "notify" "magic" "privacy")rootPath = $GOPATH/src/path-to-servfor serv in "${servs[@]}"do tmux has-session -t $serv if [ $? = 0]; then continue fi servPath = $rootPath"/"$serv tmux new -s $serv -n serv \; \ send-keys -t $serv:0 'cd '$servPath' && bee run' \; \ splitw -d \; selectp -t 1 \; \ send-keys -t $serv:0.1 'cd '$servPath C-m \; detachdone Last Updated 2018-04-25 Wed 22:19.Render by hexo-renderer-org with Emacs 25.3.2 (Org mode 8.2.10)