我正在编写一个bash脚本,将屏幕拆分为3并在每个窗格上运行命令.
我基本上想要运行bash脚本,bash脚本应该将我的屏幕拆分为3,然后在窗格中运行top,在另一个窗格中运行htop,在第三个窗格中运行perl re.pl
任何帮助或指示都是赞赏的!
直接的方法是创建一个分离的会话,创建窗格,然后附加到会话.
# -d says not to attach to the session yet. top runs in the first
# window
tmux new-session -d top
# In the most recently created session, split the (only) window
# and run htop in the new pane
tmux split-window -v htop
# Split the new pane and run perl
tmux split-pane -v perl re.pl
# Make all three panes the same size (currently, the first pane
# is 50% of the window, and the two new panes are 25% each).
tmux select-layout even-vertical
# Now attach to the window
tmux attach-session
Run Code Online (Sandbox Code Playgroud)
您也可以在一次调用tmux中执行此操作,但可能没有理由从脚本执行此操作:
tmux new-session -d top \; split-window -v htop \; split-window -v perl re.pl \; select-layout even-vertical \; attach-session
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3712 次 |
| 最近记录: |