我重写了剧本。最棘手的部分是ssh通过退出来断开连接fish,因为exit内部./.config/fish/config.fish不起作用。
tmux仅当 的父级fish是时才开始ssh。
这是我的./.config/fish/config.fish文件的一部分:
if status --is-login
set PPID (echo (ps --pid %self -o ppid --no-headers) | xargs)
if ps --pid $PPID | grep ssh
tmux has-session -t remote; and tmux attach-session -t remote; or tmux new-session -s remote; and kill %self
echo "tmux failed to start; using plain fish shell"
end
end
Run Code Online (Sandbox Code Playgroud)
更可读的版本可以在我的另一个问题中找到(感谢fish shell的作者荒谬的鱼): How to use booleans in Fish shell?
| 归档时间: |
|
| 查看次数: |
5753 次 |
| 最近记录: |