【发布时间】:2021-03-16 04:20:37
【问题描述】:
我想防止 tmux 在脚本完成时自动退出。例如,我有一个类似这样的命令(如下),它确实为应用程序运行服务器,但有时会意外退出并出现错误。发生这种情况时,我无法检查代码、命令有什么问题。
tmux new-session -d -s "visited" 'bash -ic "visited --server"';
以下是我想做的简化命令。
tmux new-session -d -s "pwd" 'bash -c pwd' # but actually I need to load .bashrc
tmux a -t pwd # this should attach to the shell, but in my environment this does show "can't find session pwd" since the shell is already exited
我阅读了一个 github issue 并尝试将 set exit-empty off 添加到 ~/.tmux.conf 并重新启动服务器 tmux kill-server 并重新尝试了上述方法,但似乎它不起作用。
【问题讨论】:
-
bash -c command启动一个 Bash 实例,运行command,然后退出。
标签: shell command-line tmux