【发布时间】:2012-12-06 18:12:26
【问题描述】:
我想打开一个包含 cmus 的新 tmux 会话和窗口,或者,如果已经在运行,则附加到它。在Ubuntuusers,我找到了应该执行此操作的脚本。
1. #!/bin/bash
2. SESSION=main
3. tmux="tmux -2 -f tmux.conf"
4.
5. # if the session is already running, just attach to it.
5. $tmux has-session -t $SESSION
7. if [ $? -eq 0 ]; then
8. echo "Session $SESSION already exists. Attaching."
9. sleep 1
10. $tmux attach -t $SESSION
11. exit 0;
12. fi
我已经知道我可以手动完成它
tmux new -n music cmus
但是当我在脚本中使用它时,我只会收到消息
usage: new-session [-d] [-n window-name] [-s session-name] [-t target-session] [-x width] [-y height] [command]
我也尝试了新会话,但没有变化。我完全不知道命令或脚本或两者都有什么问题
【问题讨论】: